Skip to content
Merged
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
11 changes: 10 additions & 1 deletion src/mono/mono/tools/offsets-tool/clang/cindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,11 @@ def name(self):

@classmethod
def from_id(cls, id):
if cls == CursorKind and id == 300:
# --- DOTNET change ---
# The id of CursorKind.TRANSLATION_UNIT changed in https://github.com/llvm/llvm-project/commit/bb83f8e70bd1d56152f02307adacd718cd67e312,
# add mapping from the old to the new value so using the binding with an older clang still works.
return cls._kinds[350]
if id >= len(cls._kinds) or cls._kinds[id] is None:
raise ValueError('Unknown template argument kind %d' % id)
return cls._kinds[id]
Expand Down Expand Up @@ -1312,7 +1317,7 @@ def __repr__(self):
#
# The translation unit cursor exists primarily to act as the root cursor for
# traversing the contents of a translation unit.
CursorKind.TRANSLATION_UNIT = CursorKind(300)
CursorKind.TRANSLATION_UNIT = CursorKind(350)

###
# Attributes
Expand Down Expand Up @@ -1342,6 +1347,8 @@ def __repr__(self):

CursorKind.DLLEXPORT_ATTR = CursorKind(418)
CursorKind.DLLIMPORT_ATTR = CursorKind(419)
# Temporary fake value to work around xcode 15 beta / clang 15
CursorKind.XCODEBETA_ATTR = CursorKind(437)
CursorKind.CONVERGENT_ATTR = CursorKind(438)
CursorKind.WARN_UNUSED_ATTR = CursorKind(439)
CursorKind.WARN_UNUSED_RESULT_ATTR = CursorKind(440)
Expand Down Expand Up @@ -2059,6 +2066,7 @@ def __repr__(self):
TypeKind.OBJCSEL = TypeKind(29)
TypeKind.FLOAT128 = TypeKind(30)
TypeKind.HALF = TypeKind(31)
TypeKind.IBM128 = TypeKind(40)
TypeKind.COMPLEX = TypeKind(100)
TypeKind.POINTER = TypeKind(101)
TypeKind.BLOCKPOINTER = TypeKind(102)
Expand Down Expand Up @@ -2122,6 +2130,7 @@ def __repr__(self):
TypeKind.OCLRESERVEID = TypeKind(160)

TypeKind.EXTVECTOR = TypeKind(176)
TypeKind.ATOMIC = TypeKind(177)

class RefQualifierKind(BaseEnumeration):
"""Describes a specific ref-qualifier of a type."""
Expand Down
10 changes: 8 additions & 2 deletions src/mono/mono/tools/offsets-tool/offsets-tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,11 @@ def gen (self):
if type.size == -1:
continue
f.write ("DECL_SIZE2(%s,%s)\n" % (type.name, type.size))
done_fields = {}
for field in type.fields:
f.write ("DECL_OFFSET2(%s,%s,%s)\n" % (type.name, field.name, field.offset))
if field.name not in done_fields:
f.write ("DECL_OFFSET2(%s,%s,%s)\n" % (type.name, field.name, field.offset))
done_fields [field.name] = field.name
f.write ("#endif //disable metadata check\n")

f.write ("#ifndef DISABLE_JIT_OFFSETS\n")
Expand All @@ -376,8 +379,11 @@ def gen (self):
if type.size == -1:
continue
f.write ("DECL_SIZE2(%s,%s)\n" % (type.name, type.size))
done_fields = {}
for field in type.fields:
f.write ("DECL_OFFSET2(%s,%s,%s)\n" % (type.name, field.name, field.offset))
if field.name not in done_fields:
f.write ("DECL_OFFSET2(%s,%s,%s)\n" % (type.name, field.name, field.offset))
done_fields [field.name] = field.name
f.write ("#endif //disable jit check\n")

f.write ("#endif //cross compiler checks\n")
Expand Down