summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker/AnalyzerStatsChecker.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-11-12 07:15:47 +0000
committerDouglas Gregor <dgregor@apple.com>2010-11-12 07:15:47 +0000
commit453b012513e67aa99b3d4c5f7712231012efeca3 (patch)
treef50a2385ab797dfb12f0745b98f0fe697332b5c2 /clang/lib/Checker/AnalyzerStatsChecker.cpp
parentea18d8ec2d4c153511d38f85e65c78c3e637d3c6 (diff)
downloadbcm5719-llvm-453b012513e67aa99b3d4c5f7712231012efeca3.tar.gz
bcm5719-llvm-453b012513e67aa99b3d4c5f7712231012efeca3.zip
Make sure to always check the result of
SourceManager::getPresumedLoc(), so that we don't try to make use of an invalid presumed location. Doing so can cause crashes. llvm-svn: 118885
Diffstat (limited to 'clang/lib/Checker/AnalyzerStatsChecker.cpp')
-rw-r--r--clang/lib/Checker/AnalyzerStatsChecker.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/clang/lib/Checker/AnalyzerStatsChecker.cpp b/clang/lib/Checker/AnalyzerStatsChecker.cpp
index 9badb79625d..c484537e957 100644
--- a/clang/lib/Checker/AnalyzerStatsChecker.cpp
+++ b/clang/lib/Checker/AnalyzerStatsChecker.cpp
@@ -83,16 +83,18 @@ void AnalyzerStatsChecker::VisitEndAnalysis(ExplodedGraph &G,
llvm::SmallString<128> buf;
llvm::raw_svector_ostream output(buf);
PresumedLoc Loc = SM.getPresumedLoc(D->getLocation());
- output << Loc.getFilename() << " : ";
+ if (Loc.isValid()) {
+ output << Loc.getFilename() << " : ";
- if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
- const NamedDecl *ND = cast<NamedDecl>(D);
- output << ND;
- }
- else if (isa<BlockDecl>(D)) {
- output << "block(line:" << Loc.getLine() << ":col:" << Loc.getColumn();
+ if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
+ const NamedDecl *ND = cast<NamedDecl>(D);
+ output << ND;
+ }
+ else if (isa<BlockDecl>(D)) {
+ output << "block(line:" << Loc.getLine() << ":col:" << Loc.getColumn();
+ }
}
-
+
output << " -> Total CFGBlocks: " << total << " | Unreachable CFGBlocks: "
<< unreachable << " | Aborted Block: "
<< (Eng.wasBlockAborted() ? "yes" : "no")
OpenPOWER on IntegriCloud