Skip to content

Address truncation in types #68253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions include/swift/AST/CASTBridging.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
SWIFT_BEGIN_ASSUME_NONNULL

typedef long SwiftInt;
typedef unsigned long SwiftUInt;
typedef long long SwiftInt;
typedef unsigned long long SwiftUInt;

typedef struct {
const unsigned char *_Nullable data;
long length;
size_t length;
} BridgedString;

typedef struct {
const void *_Nullable data;
long numElements;
size_t numElements;
} BridgedArrayRef;

typedef struct BridgedASTContext {
Expand Down Expand Up @@ -113,7 +113,7 @@ typedef struct BridgedDiagnosticEngine {
void *raw;
} BridgedDiagnosticEngine;

typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedMacroDefinitionKind : long {
typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedMacroDefinitionKind : size_t {
/// An expanded macro.
BridgedExpandedMacro = 0,
/// An external macro, spelled with either the old spelling (Module.Type)
Expand Down Expand Up @@ -307,7 +307,7 @@ void *IfStmt_create(BridgedASTContext cContext, BridgedSourceLoc cIfLoc,
void *BraceStmt_create(BridgedASTContext cContext, BridgedSourceLoc cLBLoc,
BridgedArrayRef elements, BridgedSourceLoc cRBLoc);

BridgedSourceLoc SourceLoc_advanced(BridgedSourceLoc cLoc, long len);
BridgedSourceLoc SourceLoc_advanced(BridgedSourceLoc cLoc, size_t len);

void *ParamDecl_create(BridgedASTContext cContext, BridgedSourceLoc cLoc,
BridgedSourceLoc cArgLoc, BridgedIdentifier argName,
Expand Down Expand Up @@ -357,7 +357,7 @@ void *GenericTypeParamDecl_create(BridgedASTContext cContext,
BridgedDeclContext cDeclContext,
BridgedIdentifier name,
BridgedSourceLoc cNameLoc,
BridgedSourceLoc cEachLoc, long index,
BridgedSourceLoc cEachLoc, size_t index,
_Bool isParameterPack);
void GenericTypeParamDecl_setInheritedType(BridgedASTContext cContext,
void *Param, void *ty);
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Basic/CBasicBridging.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SWIFT_BEGIN_ASSUME_NONNULL

typedef struct BridgedData {
const char *_Nullable baseAddress;
unsigned long size;
size_t size;
} BridgedData;

void BridgedData_free(BridgedData data);
Expand Down
4 changes: 2 additions & 2 deletions lib/AST/CASTBridging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void *ImportDecl_create(BridgedASTContext cContext,
std::move(importPath).get());
}

BridgedSourceLoc SourceLoc_advanced(BridgedSourceLoc cLoc, long len) {
BridgedSourceLoc SourceLoc_advanced(BridgedSourceLoc cLoc, size_t len) {
SourceLoc loc = convertSourceLoc(cLoc).getAdvancedLoc(len);
return {loc.getOpaquePointerValue()};
}
Expand Down Expand Up @@ -764,7 +764,7 @@ void *GenericTypeParamDecl_create(BridgedASTContext cContext,
BridgedDeclContext cDeclContext,
BridgedIdentifier name,
BridgedSourceLoc cNameLoc,
BridgedSourceLoc cEachLoc, long index,
BridgedSourceLoc cEachLoc, size_t index,
bool isParameterPack) {
return GenericTypeParamDecl::createParsed(
convertDeclContext(cDeclContext), convertIdentifier(name),
Expand Down