CarlosAlbertoEnciso added a comment. My initial approach was based on the following test case:
void Bar() { typedef int I_Ref; I_Ref var_bar; } void Foo() { typedef int I_Used; I_Used var_foo; var_foo = 2; } void Test() { Foo(); } and the generated AST looks like: |-FunctionDecl Bar 'void ()' | |-DeclStmt | | `-TypedefDecl referenced I_Ref 'int' | |-DeclStmt | `-VarDecl var_bar 'I_Ref':'int' |-FunctionDecl used Foo 'void ()' | |-DeclStmt | | `-TypedefDecl referenced I_Used 'int' | |-DeclStmt | | `-VarDecl used var_foo 'I_Used':'int' The typedef 'I_Ref' is marked as 'referenced' due to its association with 'var_bar'. The typedef 'I_Used' is marked as 'referenced' despite that its association with 'var_foo' which is 'used' Both 'typedefs' are marked as 'referenced'. With the intended patch, the AST looks like: |-FunctionDecl Bar 'void ()' | |-DeclStmt | | `-TypedefDecl referenced I_Ref 'int' | `-DeclStmt | `-VarDecl var_bar 'I_Ref':'int' |-FunctionDecl used Foo 'void ()' | |-DeclStmt | | `-TypedefDecl used I_Used 'int' | |-DeclStmt | | `-VarDecl used var_foo 'I_Used':'int' The typedef 'I_Ref' is marked as 'referenced'. The typedef 'I_Used' is marked as 'used'. Repository: rC Clang https://reviews.llvm.org/D46190 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits