aboutsummaryrefslogtreecommitdiff
path: root/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
commitb7530a4ca9a7ef62350682bbb374a06de6fdaa9f (patch)
treeb4889b151572743423645e3190df012f042a0135 /lib/StaticAnalyzer/Core/BugReporter.cpp
parent3060178ad9df29789505c1e6debcfc80a3a13587 (diff)
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
Diffstat (limited to 'lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/BugReporter.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp
index a06dc369d7..95303a034d 100644
--- a/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/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);
}