https://llvm.org/bugs/show_bug.cgi?id=25803
Bug ID: 25803 Summary: libclang does not seem to find references to certain constructs Product: clang Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: libclang Assignee: unassignedclangb...@nondot.org Reporter: agbak...@gmail.com CC: kli...@google.com, llvm-bugs@lists.llvm.org Classification: Unclassified For the following example: class Foo { public: operator bool() const { return true; } Foo &operator=(const Foo &) { return *this; } }; int main(int, char **) { Foo b; if (Foo f = b) { } return 0; } I get following output from clang-check -ast-dump: TranslationUnitDecl 0x68be850 <<invalid sloc>> <invalid sloc> |-TypedefDecl 0x68bed88 <<invalid sloc>> <invalid sloc> implicit __int128_t '__int128' |-TypedefDecl 0x68bede8 <<invalid sloc>> <invalid sloc> implicit __uint128_t 'unsigned __int128' |-TypedefDecl 0x68bee78 <<invalid sloc>> <invalid sloc> implicit __builtin_ms_va_list 'char *' |-TypedefDecl 0x68bf198 <<invalid sloc>> <invalid sloc> implicit __builtin_va_list 'struct __va_list_tag [1]' |-CXXRecordDecl 0x68bf1e8 </home/abakken/temp/safebool/main.cpp:1:1, line:6:1> line:1:7 referenced class Foo definition | |-CXXRecordDecl 0x68bf300 <col:1, col:7> col:7 implicit referenced class Foo | |-AccessSpecDecl 0x68bf390 <line:3:1, col:7> col:1 public | |-CXXConversionDecl 0x68bf470 <line:4:5, col:42> col:5 used operator bool '_Bool (void) const' | | `-CompoundStmt 0x6913410 <col:27, col:42> | | `-ReturnStmt 0x69133f8 <col:29, col:36> | | `-CXXBoolLiteralExpr 0x69133e0 <col:36> '_Bool' true | |-CXXMethodDecl 0x6913330 <line:5:5, col:49> col:10 operator= 'class Foo &(const class Foo &)' | | |-ParmVarDecl 0x6913210 <col:20, col:30> col:31 'const class Foo &' | | `-CompoundStmt 0x6913480 <col:33, col:49> | | `-ReturnStmt 0x6913468 <col:35, col:43> | | `-UnaryOperator 0x6913448 <col:42, col:43> 'class Foo' lvalue prefix '*' | | `-CXXThisExpr 0x6913430 <col:43> 'class Foo *' this | |-CXXConstructorDecl 0x69137a8 <line:1:7> col:7 implicit used constexpr Foo 'void (void) noexcept' inline | | `-CompoundStmt 0x6913ac0 <col:7> | `-CXXConstructorDecl 0x69138d8 <col:7> col:7 implicit used constexpr Foo 'void (const class Foo &) noexcept' inline | |-ParmVarDecl 0x6913a20 <col:7> col:7 'const class Foo &' | `-CompoundStmt 0x6913bd0 <col:7> `-FunctionDecl 0x6913620 <line:8:1, line:15:1> line:8:5 main 'int (int, char **)' |-ParmVarDecl 0x69134b0 <col:10> col:13 'int' |-ParmVarDecl 0x6913550 <col:15, col:21> col:22 'char **' `-CompoundStmt 0x6913de0 <line:9:1, line:15:1> |-DeclStmt 0x6913b08 <line:10:5, col:10> | `-VarDecl 0x6913728 <col:5, col:9> col:9 used b 'class Foo' callinit | `-CXXConstructExpr 0x6913ad8 <col:9> 'class Foo' 'void (void) noexcept' |-IfStmt 0x6913d60 <line:11:5, line:13:5> | |-DeclStmt 0x6913d90 <line:11:9, col:17> | | `-VarDecl 0x6913b30 <col:9, col:17> col:13 used f 'class Foo' cinit | | `-CXXConstructExpr 0x6913c28 <col:17> 'class Foo' 'void (const class Foo &) noexcept' | | `-ImplicitCastExpr 0x6913bb8 <col:17> 'const class Foo' lvalue <NoOp> | | `-DeclRefExpr 0x6913b90 <col:17> 'class Foo' lvalue Var 0x6913728 'b' 'class Foo' | |-ImplicitCastExpr 0x6913d48 <col:13> '_Bool' <UserDefinedConversion> | | `-CXXMemberCallExpr 0x6913d20 <col:13> '_Bool' | | `-MemberExpr 0x6913ce8 <col:13> '<bound member function type>' .operator bool 0x68bf470 | | `-ImplicitCastExpr 0x6913cd0 <col:13> 'const class Foo' lvalue <NoOp> | | `-DeclRefExpr 0x6913c78 <col:13> 'class Foo' lvalue Var 0x6913b30 'f' 'class Foo' | |-CompoundStmt 0x6913c60 <col:20, line:13:5> | `-<<<NULL>>> `-ReturnStmt 0x6913dc8 <line:14:5, col:12> `-IntegerLiteral 0x6913da8 <col:12> 'int' 0 There's no mention of the reference to the operator= on this line: if (Foo f = b) { I also don't seem to get any reference with the c api in libclang (which is what I care more about). -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs