Remove DiagBugReport by pulling it into its parent BugReport.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137899 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp
index a06dc36..95303a0 100644
--- a/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -1311,7 +1311,10 @@
}
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 @@
return S->getLocStart();
}
+ } else {
+ assert(Location.isValid());
+ return Location;
+ }
+
return FullSourceLoc();
}
@@ -1933,7 +1941,7 @@
// '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);
}