Tweak UndefBranchChecker to register the most nested "undefined" expression with bugreporter::registerTrackNullOrUndefValue instead of the condition itself.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89682 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/UndefBranchChecker.cpp b/lib/Analysis/UndefBranchChecker.cpp
index 0a66e21..b6861ba 100644
--- a/lib/Analysis/UndefBranchChecker.cpp
+++ b/lib/Analysis/UndefBranchChecker.cpp
@@ -73,9 +73,6 @@
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 @@
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);