From 288b705450ca84dbb73fc85bcb94f8a18e6da311 Mon Sep 17 00:00:00 2001 From: luoliwoshang <2643523683@qq.com> Date: Tue, 12 Nov 2024 20:26:33 +0800 Subject: [PATCH] clang:included & system header --- c/clang/_wrap/cursor.cpp | 4 ++++ c/clang/clang.go | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/c/clang/_wrap/cursor.cpp b/c/clang/_wrap/cursor.cpp index 3b29b957..7bfb4031 100644 --- a/c/clang/_wrap/cursor.cpp +++ b/c/clang/_wrap/cursor.cpp @@ -33,6 +33,8 @@ void wrap_clang_getOverriddenCursors(CXCursor *cursor, CXCursor **overridden, un clang_getOverriddenCursors(*cursor, overridden, num_overridden); } +CXFile wrap_clang_getIncludedFile(CXCursor *cursor) { return clang_getIncludedFile(*cursor); } + void wrap_clang_getCursor(CXTranslationUnit uint, CXSourceLocation *loc, CXCursor *cur) { *cur = clang_getCursor(uint, *loc); } @@ -192,6 +194,8 @@ unsigned wrap_clang_visitChildren(CXCursor *parent, wrap_CXCursorVisitor visitor return clang_visitChildren(*parent, wrap_visitor, CXClientData(&data)); } +int wrap_clang_Location_isInSystemHeader(CXSourceLocation *loc) { return clang_Location_isInSystemHeader(*loc); } + void wrap_clang_getSpellingLocation(CXSourceLocation *loc, CXFile *file, unsigned *line, unsigned *column, unsigned *offset) { clang_getSpellingLocation(*loc, file, line, column, offset); diff --git a/c/clang/clang.go b/c/clang/clang.go index f58c7d54..f3136d93 100644 --- a/c/clang/clang.go +++ b/c/clang/clang.go @@ -1710,6 +1710,19 @@ func (c Cursor) OverriddenCursors(overridden **Cursor, numOverridden *c.Uint) { // llgo:link (*Cursor).DisposeOverriddenCursors C.clang_disposeOverriddenCursors func (c *Cursor) DisposeOverriddenCursors() {} +/** + * Retrieve the file that is included by the given inclusion directive + * cursor. + */ +// llgo:link (*Cursor).wrapIncludedFile C.wrap_clang_getIncludedFile +func (c *Cursor) wrapIncludedFile() File { + return 0 +} + +func (c Cursor) IncludedFile() (file File) { + return c.wrapIncludedFile() +} + /** * Map a source location to the cursor that describes the entity at that * location in the source code. @@ -2719,6 +2732,16 @@ func (t *TranslationUnit) Tokenize(ran SourceRange, tokens **Token, numTokens *c // llgo:link (*TranslationUnit).DisposeTokens C.clang_disposeTokens func (t *TranslationUnit) DisposeTokens(tokens *Token, numTokens c.Uint) {} +/** + * Returns non-zero if the given source location is in a system header. + */ +// llgo:link (*SourceLocation).wrapIsInSystemHeader C.wrap_clang_Location_isInSystemHeader +func (l *SourceLocation) wrapIsInSystemHeader() (ret c.Uint) { return 0 } + +func (l SourceLocation) IsInSystemHeader() (ret c.Uint) { + return l.wrapIsInSystemHeader() +} + /** * Retrieve the file, line, column, and offset represented by * the given source location.