summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/UndefBranchChecker.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-11-23 18:12:03 +0000
committerTed Kremenek <kremenek@apple.com>2009-11-23 18:12:03 +0000
commit02d6aca867839102084f7e3a9f21485fef901fb0 (patch)
treef54b8f560c16ed151eab063bb401890d7421cb3d /clang/lib/Analysis/UndefBranchChecker.cpp
parent1a6c47f1cb7069ec3cf708e6b56fd6c5632fb218 (diff)
downloadbcm5719-llvm-02d6aca867839102084f7e3a9f21485fef901fb0.tar.gz
bcm5719-llvm-02d6aca867839102084f7e3a9f21485fef901fb0.zip
Tweak UndefBranchChecker to register the most nested "undefined" expression with bugreporter::registerTrackNullOrUndefValue instead of the condition itself.
llvm-svn: 89682
Diffstat (limited to 'clang/lib/Analysis/UndefBranchChecker.cpp')
-rw-r--r--clang/lib/Analysis/UndefBranchChecker.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Analysis/UndefBranchChecker.cpp b/clang/lib/Analysis/UndefBranchChecker.cpp
index 0a66e21de94..b6861ba5a0c 100644
--- a/clang/lib/Analysis/UndefBranchChecker.cpp
+++ b/clang/lib/Analysis/UndefBranchChecker.cpp
@@ -73,9 +73,6 @@ void UndefBranchChecker::VisitBranchCondition(GRBranchNodeBuilder &Builder,
N->markAsSink();
if (!BT)
BT = new BuiltinBug("Branch condition evaluates to a garbage value");
- EnhancedBugReport *R = new EnhancedBugReport(*BT, BT->getDescription(),N);
- R->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue,
- Condition);
// What's going on here: we want to highlight the subexpression of the
// condition that is the most likely source of the "uninitialized
@@ -105,6 +102,10 @@ void UndefBranchChecker::VisitBranchCondition(GRBranchNodeBuilder &Builder,
FindUndefExpr FindIt(Eng.getStateManager(), St);
Ex = FindIt.FindExpr(Ex);
+
+ // Emit the bug report.
+ EnhancedBugReport *R = new EnhancedBugReport(*BT, BT->getDescription(),N);
+ R->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, Ex);
R->addRange(Ex->getSourceRange());
Eng.getBugReporter().EmitReport(R);
OpenPOWER on IntegriCloud