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 | 9b9685dc713679581b3953cd9ece0001b63f551f (patch) | |
tree | e0c20b12c578d5b7c29b895f200ef14ba94af395 /lib/Index/ASTLocation.cpp | |
parent | 93fab9d67ca62e3e291803e5a1309473d6e00344 (diff) |
Handle invalid ASTLocations instead of asserting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76335 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Index/ASTLocation.cpp')
-rw-r--r-- | lib/Index/ASTLocation.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Index/ASTLocation.cpp b/lib/Index/ASTLocation.cpp index f73ddc087a..d83e0e33f3 100644 --- a/lib/Index/ASTLocation.cpp +++ b/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())) |