Skip to content

Commit e91fa8a

Browse files
committed
cleanup autogenerated stuff
1 parent 134e9d2 commit e91fa8a

1,050 files changed

Lines changed: 46 additions & 1550678 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

metadata-generator/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
metagen_out
2-
dist/
2+
dist/
3+
metadata/
4+
build*/
5+
__pycache__/

metadata-generator/include/Util.h

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,44 @@ inline bool cursorPrettyTextContains(CXCursor cursor, const char* needle) {
294294
return contains;
295295
}
296296

297+
inline bool cursorTokensContain(CXCursor cursor, const char* tokenText) {
298+
if (tokenText == nullptr || tokenText[0] == '\0') {
299+
return false;
300+
}
301+
302+
CXTranslationUnit tu = clang_Cursor_getTranslationUnit(cursor);
303+
if (tu == nullptr) {
304+
return false;
305+
}
306+
307+
CXToken* tokens = nullptr;
308+
unsigned tokenCount = 0;
309+
clang_tokenize(tu, clang_getCursorExtent(cursor), &tokens, &tokenCount);
310+
311+
bool found = false;
312+
for (unsigned i = 0; i < tokenCount; i++) {
313+
CXString cxToken = clang_getTokenSpelling(tu, tokens[i]);
314+
const char* spelling = clang_getCString(cxToken);
315+
if (spelling != nullptr && std::strcmp(spelling, tokenText) == 0) {
316+
found = true;
317+
clang_disposeString(cxToken);
318+
break;
319+
}
320+
clang_disposeString(cxToken);
321+
}
322+
323+
if (tokens != nullptr) {
324+
clang_disposeTokens(tu, tokens, tokenCount);
325+
}
326+
327+
return found;
328+
}
329+
297330
inline bool cursorHasReturnsRetainedAttribute(CXCursor cursor) {
298331
struct ReturnsRetainedSearch {
299332
bool hasAttribute = false;
300-
} search;
333+
CXCursor cursor;
334+
} search = {false, cursor};
301335

302336
clang_visitChildren(
303337
cursor,
@@ -309,7 +343,8 @@ inline bool cursorHasReturnsRetainedAttribute(CXCursor cursor) {
309343
}
310344

311345
if (child.kind == CXCursor_UnexposedAttr &&
312-
cursorPrettyTextContains(child, "cf_returns_retained")) {
346+
(cursorTokensContain(search->cursor, "CF_RETURNS_RETAINED") ||
347+
cursorPrettyTextContains(search->cursor, "cf_returns_retained"))) {
313348
search->hasAttribute = true;
314349
return CXChildVisit_Break;
315350
}
@@ -318,14 +353,7 @@ inline bool cursorHasReturnsRetainedAttribute(CXCursor cursor) {
318353
},
319354
&search);
320355

321-
if (search.hasAttribute) {
322-
return true;
323-
}
324-
325-
// Some libclang builds expose `CF_RETURNS_RETAINED` only through declaration
326-
// pretty-print text.
327-
return cursorPrettyTextContains(cursor, "cf_returns_retained") ||
328-
cursorPrettyTextContains(cursor, "CF_RETURNS_RETAINED");
356+
return search.hasAttribute;
329357
}
330358

331359
} // namespace metagen

metadata-generator/metadata/metadata.ios-sim.arm64.h

Lines changed: 0 additions & 1029 deletions
This file was deleted.
-4.36 MB
Binary file not shown.

metadata-generator/metadata/metadata.ios-sim.x86_64.h

Lines changed: 0 additions & 1029 deletions
This file was deleted.
-4.37 MB
Binary file not shown.

metadata-generator/metadata/metadata.ios.arm64.h

Lines changed: 0 additions & 1006 deletions
This file was deleted.
-4.43 MB
Binary file not shown.

metadata-generator/metadata/metadata.macos.arm64.h

Lines changed: 0 additions & 3046 deletions
This file was deleted.
-6.7 MB
Binary file not shown.

0 commit comments

Comments
 (0)