aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BugReporter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/BugReporter.cpp')
-rw-r--r--lib/Analysis/BugReporter.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index 26dba4e7e8..1741e7dc9b 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -27,22 +27,20 @@
using namespace clang;
BugReporter::~BugReporter() {}
+GRBugReporter::~GRBugReporter() {}
+BugReporterData::~BugReporterData() {}
BugType::~BugType() {}
BugReport::~BugReport() {}
RangedBugReport::~RangedBugReport() {}
-ExplodedGraph<ValueState>& BugReporter::getGraph() {
+ExplodedGraph<ValueState>& GRBugReporter::getGraph() {
return Eng.getGraph();
}
-ValueStateManager& BugReporter::getStateManager() {
+ValueStateManager& GRBugReporter::getStateManager() {
return Eng.getStateManager();
}
-ParentMap& BugReporter::getParentMap() {
- return Eng.getParentMap();
-}
-
static inline Stmt* GetStmt(const ProgramPoint& P) {
if (const PostStmt* PS = dyn_cast<PostStmt>(&P)) {
return PS->getStmt();
@@ -338,7 +336,7 @@ static void HandleNotableSymbol(ExplodedNode<ValueState>* N, Stmt* S,
// specified symbol. Are any of them not in the previous state.
ValueState* St = N->getState();
- ValueStateManager& VMgr = BR.getStateManager();
+ ValueStateManager& VMgr = cast<GRBugReporter>(BR).getStateManager();
// FIXME: Later generalize for a broader memory model.
@@ -411,8 +409,8 @@ static void HandleNotableSymbol(ExplodedNode<ValueState>* N, Stmt* S,
}
}
-void BugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
- BugReport& R) {
+void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
+ BugReport& R) {
ExplodedNode<ValueState>* N = R.getEndNode();
@@ -438,6 +436,7 @@ void BugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
ExplodedNode<ValueState>* NextNode = N->pred_empty()
? NULL : *(N->pred_begin());
+ ASTContext& Ctx = getContext();
SourceManager& SMgr = Ctx.getSourceManager();
while (NextNode) {
@@ -715,6 +714,8 @@ void BugReporter::EmitWarning(BugReport& R) {
// Emit a full diagnostic for the path if we have a PathDiagnosticClient.
+ PathDiagnosticClient* PD = getPathDiagnosticClient();
+
if (PD && !D->empty()) {
PD->HandlePathDiagnostic(D.take());
return;
@@ -723,7 +724,7 @@ void BugReporter::EmitWarning(BugReport& R) {
// We don't have a PathDiagnosticClient, but we can still emit a single
// line diagnostic. Determine the location.
- FullSourceLoc L = D->empty() ? R.getLocation(Ctx.getSourceManager())
+ FullSourceLoc L = D->empty() ? R.getLocation(getSourceManager())
: D->back()->getLocation();
@@ -749,7 +750,6 @@ void BugReporter::EmitWarning(BugReport& R) {
}
else {
std::ostringstream os;
- os << "[CHECKER] ";
if (D->empty())
os << R.getDescription();
@@ -757,6 +757,7 @@ void BugReporter::EmitWarning(BugReport& R) {
os << D->back()->getString();
+ Diagnostic& Diag = getDiagnostic();
unsigned ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning,
os.str().c_str());