diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-14 03:18:40 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-14 03:18:40 +0000 |
commit | 2f0eff102ce613c1b5a83b6130ee5aa6d71a5ace (patch) | |
tree | 90ac249fcdcdfef00ac6cc4f9244477b0389b795 /clang/tools/index-test/index-test.cpp | |
parent | 558449bf7961e4aa9d589fbac579c6b0b792a9aa (diff) | |
download | bcm5719-llvm-2f0eff102ce613c1b5a83b6130ee5aa6d71a5ace.tar.gz bcm5719-llvm-2f0eff102ce613c1b5a83b6130ee5aa6d71a5ace.zip |
Handle struct fields through the index-test tool.
llvm-svn: 75596
Diffstat (limited to 'clang/tools/index-test/index-test.cpp')
-rw-r--r-- | clang/tools/index-test/index-test.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/tools/index-test/index-test.cpp b/clang/tools/index-test/index-test.cpp index 815d0d0adf6..b7471a1c9d0 100644 --- a/clang/tools/index-test/index-test.cpp +++ b/clang/tools/index-test/index-test.cpp @@ -95,6 +95,8 @@ DisableFree("disable-free", llvm::cl::desc("Disable freeing of memory on exit"), llvm::cl::init(false)); +static bool HadErrors = false; + static void ProcessDecl(Decl *D) { assert(D); llvm::raw_ostream &OS = llvm::outs(); @@ -155,10 +157,17 @@ static void ProcessASTLocation(ASTLocation ASTLoc, IndexProvider &IdxProvider) { if (ASTLoc.isStmt()) { if (DeclRefExpr *RefExpr = dyn_cast<DeclRefExpr>(ASTLoc.getStmt())) D = RefExpr->getDecl(); + else if (MemberExpr *ME = dyn_cast<MemberExpr>(ASTLoc.getStmt())) + D = ME->getMemberDecl(); } else { D = ASTLoc.getDecl(); } - assert(D); + + if (D == 0) { + llvm::errs() << "Error: Couldn't get a Decl out of the ASTLocation"; + HadErrors = true; + return; + } Entity *Ent = Entity::get(D, IdxProvider.getProgram()); // If there is no Entity associated with this Decl, it means that it's not @@ -267,6 +276,9 @@ int main(int argc, char **argv) { ProcessASTLocation(ASTLoc, IdxProvider); } } + + if (HadErrors) + return 1; if (!DisableFree) { for (int i=0, e=TUnits.size(); i != e; ++i) |