diff options
author | John McCall <rjmccall@apple.com> | 2009-10-24 08:00:42 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-10-24 08:00:42 +0000 |
commit | 703a3f8a7ba3df3c04ca78c1ab29889d4ea98477 (patch) | |
tree | e109b01a7659eadaa269cd4500ceff49a1176980 /clang/lib/Index/ResolveLocation.cpp | |
parent | 3db7bd27c25c567cfa606a38cedc47c981d7fc2a (diff) | |
download | bcm5719-llvm-703a3f8a7ba3df3c04ca78c1ab29889d4ea98477.tar.gz bcm5719-llvm-703a3f8a7ba3df3c04ca78c1ab29889d4ea98477.zip |
Preserve type source information in TypedefDecls. Preserve it across
template instantiation. Preserve it through PCH. Show it off to the indexer.
I'm healthily ignoring the vector type cases because we don't have a sensible
TypeLoc implementation for them anyway.
llvm-svn: 84994
Diffstat (limited to 'clang/lib/Index/ResolveLocation.cpp')
-rw-r--r-- | clang/lib/Index/ResolveLocation.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Index/ResolveLocation.cpp b/clang/lib/Index/ResolveLocation.cpp index 8edd634f8af..4e992f752b2 100644 --- a/clang/lib/Index/ResolveLocation.cpp +++ b/clang/lib/Index/ResolveLocation.cpp @@ -45,6 +45,9 @@ protected: if (DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(D)) if (ContainsLocation(DD->getDeclaratorInfo())) return ContainsLoc; + if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) + if (ContainsLocation(TD->getTypeDeclaratorInfo())) + return ContainsLoc; return CheckRange(D->getSourceRange()); } @@ -109,6 +112,7 @@ public: ASTLocation VisitVarDecl(VarDecl *D); ASTLocation VisitFunctionDecl(FunctionDecl *D); ASTLocation VisitObjCMethodDecl(ObjCMethodDecl *D); + ASTLocation VisitTypedefDecl(TypedefDecl *D); ASTLocation VisitDecl(Decl *D); }; @@ -278,6 +282,16 @@ ASTLocation DeclLocResolver::VisitDeclaratorDecl(DeclaratorDecl *D) { return ASTLocation(D); } +ASTLocation DeclLocResolver::VisitTypedefDecl(TypedefDecl *D) { + assert(ContainsLocation(D) && + "Should visit only after verifying that loc is in range"); + + if (ContainsLocation(D->getTypeDeclaratorInfo())) + return ResolveInDeclarator(D, /*Stmt=*/0, D->getTypeDeclaratorInfo()); + + return ASTLocation(D); +} + ASTLocation DeclLocResolver::VisitVarDecl(VarDecl *D) { assert(ContainsLocation(D) && "Should visit only after verifying that loc is in range"); |