summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-08-17 23:21:23 +0000
committerAnna Zaks <ganna@apple.com>2011-08-17 23:21:23 +0000
commit525cfe7d28c0bd2751ffac3b3b8b14bf5c298c04 (patch)
tree5961ab3e50482f34c624f00c231f743e3a6c316f /clang/lib/StaticAnalyzer/Core/BugReporter.cpp
parent1b43828958403f7eca575cd91fb01233b5cfe327 (diff)
downloadbcm5719-llvm-525cfe7d28c0bd2751ffac3b3b8b14bf5c298c04.tar.gz
bcm5719-llvm-525cfe7d28c0bd2751ffac3b3b8b14bf5c298c04.zip
Remove DiagBugReport by pulling it into its parent BugReport.
llvm-svn: 137899
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/BugReporter.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
index a06dc369d7b..95303a034d9 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -1311,7 +1311,10 @@ BugReport::getRanges() {
}
SourceLocation BugReport::getLocation() const {
- if (ErrorNode)
+ if (ErrorNode) {
+ (Location.isInvalid() &&
+ "Either Location or ErrorNode should be specified but not both.");
+
if (const Stmt *S = GetCurrentOrPreviousStmt(ErrorNode)) {
// For member expressions, return the location of the '.' or '->'.
if (const MemberExpr *ME = dyn_cast<MemberExpr>(S))
@@ -1323,6 +1326,11 @@ SourceLocation BugReport::getLocation() const {
return S->getLocStart();
}
+ } else {
+ assert(Location.isValid());
+ return Location;
+ }
+
return FullSourceLoc();
}
@@ -1933,7 +1941,7 @@ void BugReporter::EmitBasicReport(StringRef name,
// 'BT' is owned by BugReporter.
BugType *BT = getBugTypeForName(name, category);
FullSourceLoc L = getContext().getFullLoc(Loc);
- BugReport *R = new DiagBugReport(*BT, str, L);
+ BugReport *R = new BugReport(*BT, str, L);
for ( ; NumRanges > 0 ; --NumRanges, ++RBeg) R->addRange(*RBeg);
EmitReport(R);
}
OpenPOWER on IntegriCloud