[cfe-commits] r76335 - /cfe/trunk/lib/Index/ASTLocation.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Sat Jul 18 14:17:44 PDT 2009
Author: akirtzidis
Date: Sat Jul 18 16:17:43 2009
New Revision: 76335
URL: http://llvm.org/viewvc/llvm-project?rev=76335&view=rev
Log:
Handle invalid ASTLocations instead of asserting.
Modified:
cfe/trunk/lib/Index/ASTLocation.cpp
Modified: cfe/trunk/lib/Index/ASTLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/ASTLocation.cpp?rev=76335&r1=76334&r2=76335&view=diff
==============================================================================
--- cfe/trunk/lib/Index/ASTLocation.cpp (original)
+++ cfe/trunk/lib/Index/ASTLocation.cpp Sat Jul 18 16:17:43 2009
@@ -83,11 +83,16 @@
}
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()))
More information about the cfe-commits
mailing list