diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-18 21:17:43 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-18 21:17:43 +0000 |
commit | fb63b0a3172aef29b2f3f4bb320766aa8d066810 (patch) | |
tree | bcecbdfb7619d07c0c40b53967a016ecd168915b /clang/lib/Index/ASTLocation.cpp | |
parent | e376b53c7bedac425c41b3c6832ab823a4d6e8f5 (diff) | |
download | bcm5719-llvm-fb63b0a3172aef29b2f3f4bb320766aa8d066810.tar.gz bcm5719-llvm-fb63b0a3172aef29b2f3f4bb320766aa8d066810.zip |
Handle invalid ASTLocations instead of asserting.
llvm-svn: 76335
Diffstat (limited to 'clang/lib/Index/ASTLocation.cpp')
-rw-r--r-- | clang/lib/Index/ASTLocation.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Index/ASTLocation.cpp b/clang/lib/Index/ASTLocation.cpp index f73ddc087aa..d83e0e33f35 100644 --- a/clang/lib/Index/ASTLocation.cpp +++ b/clang/lib/Index/ASTLocation.cpp @@ -83,11 +83,16 @@ bool ASTLocation::isImmediateParent(Decl *D, Stmt *Node) { } SourceRange ASTLocation::getSourceRange() const { + if (isInvalid()) + return SourceRange(); return isDecl() ? getDecl()->getSourceRange() : getStmt()->getSourceRange(); } void ASTLocation::print(llvm::raw_ostream &OS) { - assert(isValid() && "ASTLocation is not valid"); + if (isInvalid()) { + OS << "<< Invalid ASTLocation >>\n"; + return; + } OS << "[Decl: " << getDecl()->getDeclKindName() << " "; if (NamedDecl *ND = dyn_cast<NamedDecl>(getDecl())) |