diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-18 21:17:58 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-18 21:17:58 +0000 |
commit | d6bf03c2725124ab574ab902b1c312e771af31a8 (patch) | |
tree | d75b6fd10532e17ca8dd66266c59365257633d0d /clang/tools/index-test/index-test.cpp | |
parent | fb63b0a3172aef29b2f3f4bb320766aa8d066810 (diff) | |
download | bcm5719-llvm-d6bf03c2725124ab574ab902b1c312e771af31a8.tar.gz bcm5719-llvm-d6bf03c2725124ab574ab902b1c312e771af31a8.zip |
Introduce ASTLocation::getReferencedDecl(), for getting the declaration that the ASTLocation references.
llvm-svn: 76336
Diffstat (limited to 'clang/tools/index-test/index-test.cpp')
-rw-r--r-- | clang/tools/index-test/index-test.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/clang/tools/index-test/index-test.cpp b/clang/tools/index-test/index-test.cpp index 10449ed0baa..9f02c2284fd 100644 --- a/clang/tools/index-test/index-test.cpp +++ b/clang/tools/index-test/index-test.cpp @@ -141,30 +141,12 @@ static void ProcessDecl(Decl *D) { } } -static Decl *getDeclFromExpr(Stmt *E) { - if (DeclRefExpr *RefExpr = dyn_cast<DeclRefExpr>(E)) - return RefExpr->getDecl(); - if (MemberExpr *ME = dyn_cast<MemberExpr>(E)) - return ME->getMemberDecl(); - if (CallExpr *CE = dyn_cast<CallExpr>(E)) - return getDeclFromExpr(CE->getCallee()); - if (CastExpr *CE = dyn_cast<CastExpr>(E)) - return getDeclFromExpr(CE->getSubExpr()); - - return 0; -} - static void ProcessASTLocation(ASTLocation ASTLoc, IndexProvider &IdxProvider) { assert(ASTLoc.isValid()); - Decl *D = 0; - if (ASTLoc.isStmt()) - D = getDeclFromExpr(ASTLoc.getStmt()); - else - D = ASTLoc.getDecl(); - + Decl *D = ASTLoc.getReferencedDecl(); if (D == 0) { - llvm::errs() << "Error: Couldn't get a Decl out of the ASTLocation"; + llvm::errs() << "Error: Couldn't get a referenced Decl for the ASTLocation"; HadErrors = true; return; } |