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: 9 additions & 2 deletions _xtool/llcppsymg/internal/symg/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,15 @@ func (p *SymbolProcessor) visitTop(cursor, parent clang.Cursor) clang.ChildVisit
case clang.CursorNamespace, clang.CursorClassDecl:
clangutils.VisitChildren(cursor, p.visitTop)
case clang.CursorCXXMethod, clang.CursorFunctionDecl, clang.CursorConstructor, clang.CursorDestructor:
isPublicMethod := (cursor.CXXAccessSpecifier() == clang.CXXPublic) && cursor.Kind == clang.CursorCXXMethod || cursor.Kind == clang.CursorConstructor || cursor.Kind == clang.CursorDestructor
if p.isSelfFile(filename) && (cursor.Kind == clang.CursorFunctionDecl || isPublicMethod) {
isPublicFunc := cursor.Kind == clang.CursorFunctionDecl &&
cursor.StorageClass() != clang.SCStatic

isPublicMethod := cursor.CXXAccessSpecifier() == clang.CXXPublic &&
cursor.Kind == clang.CursorCXXMethod ||
cursor.Kind == clang.CursorConstructor ||
cursor.Kind == clang.CursorDestructor

if p.isSelfFile(filename) && (isPublicFunc || isPublicMethod) {
p.collectFuncInfo(cursor)
}
}
Expand Down
8 changes: 8 additions & 0 deletions _xtool/llcppsymg/internal/symg/symg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ func TestGen(t *testing.T) {
"ZN9INIReaderD1Ev",
"ZNK9INIReader10ParseErrorEv",
"ZNK9INIReader3GetEPKcS1_S1_",
// Check whether private fields are filtered.
// If not, the result will certainly not match expect.json.
// NOTE(MeteorsLiu): Symbols below this comment must be removed during regeneration.
"ZN9INIReader7MakeKeyERKiS1_",
Comment thread
luoliwoshang marked this conversation as resolved.
},
},
{
Expand Down Expand Up @@ -474,6 +478,10 @@ func TestGen(t *testing.T) {
"Foo",
"Foo_Bar",
"Foo_Conf",
// only for checking the result of private fields filtering
// NOTE(MeteorsLiu): Symbols below this comment must be removed during regeneration.
"Foo_Bar_Private",
"Foo_Bar_Private2",
Comment thread
luoliwoshang marked this conversation as resolved.
},
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
#include "../conf.h"
void Foo_Bar();

#define private static
static void Foo_Bar_Private();
private
void Foo_Bar_Private2();
Loading