diff options
author | Anna Zaks <ganna@apple.com> | 2013-05-07 17:42:42 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-05-07 17:42:42 +0000 |
commit | e5e416c6de472d6e93a2ed4edb0c48d6e02d754e (patch) | |
tree | 44ecf5b15a98548ca98d1dcb1456102483f9f9b3 /clang/lib | |
parent | 6b1455f6f121976b3ddc0bb1bb6043f316bda526 (diff) | |
download | bcm5719-llvm-e5e416c6de472d6e93a2ed4edb0c48d6e02d754e.tar.gz bcm5719-llvm-e5e416c6de472d6e93a2ed4edb0c48d6e02d754e.zip |
[analyzer] Fix a crash triggered by printing a note on a default argument
Instead, use the location of the call to print the note.
llvm-svn: 181337
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index e078745737f..a397f33c992 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -697,10 +697,13 @@ PathDiagnosticPiece *FindLastStoreBRVisitor::VisitNode(const ExplodedNode *Succ, if (P.getAs<CallEnter>() && InitE) L = PathDiagnosticLocation(InitE, BRC.getSourceManager(), P.getLocationContext()); - else + + if (!L.isValid() || !L.asLocation().isValid()) L = PathDiagnosticLocation::create(P, BRC.getSourceManager()); - if (!L.isValid()) + + if (!L.isValid() || !L.asLocation().isValid()) return NULL; + return new PathDiagnosticEventPiece(L, os.str()); } |