diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-04-23 16:44:22 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-04-23 16:44:22 +0000 |
commit | 6f132351abfec8ac0ed88b39f2fb347ee266ff43 (patch) | |
tree | 3a0da50f61cb6c9e99fe2903b9fe55ec8120c937 /lib/Analysis/BugReporter.cpp | |
parent | 08f537f475901f766de003c25ad1c32b3a13cfc1 (diff) |
BugReporter (extensive diagnostics): Recursively adjust the referred expression
when popping location contexts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69898 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BugReporter.cpp')
-rw-r--r-- | lib/Analysis/BugReporter.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index e0b1b6540f..b64182e2f3 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/lib/Analysis/BugReporter.cpp @@ -790,18 +790,22 @@ class VISIBILITY_HIDDEN EdgeBuilder { PathDiagnosticLocation L = CLocs.back(); if (L.asLocation().isFileID()) { - if (const Stmt *S = L.asStmt()) { - // Adjust the location for some expressions that are best referenced - // by one of their subexpressions. - if (const ConditionalOperator *CO = dyn_cast<ConditionalOperator>(S)) - S = CO->getCond(); - else if (const ChooseExpr *CE = dyn_cast<ChooseExpr>(S)) - S = CE->getCond(); - - // Ignore parentheses. - if (const ParenExpr *PE = dyn_cast<ParenExpr>(S)) - S = PE->IgnoreParens(); - + if (const Stmt *S = L.asStmt()) { + while (1) { + // Adjust the location for some expressions that are best referenced + // by one of their subexpressions. + if (const ParenExpr *PE = dyn_cast<ParenExpr>(S)) + S = PE->IgnoreParens(); + else if (const ConditionalOperator *CO = dyn_cast<ConditionalOperator>(S)) + S = CO->getCond(); + else if (const ChooseExpr *CE = dyn_cast<ChooseExpr>(S)) + S = CE->getCond(); + else if (const BinaryOperator *BE = dyn_cast<BinaryOperator>(S)) + S = BE->getLHS(); + else + break; + } + L = PathDiagnosticLocation(S, L.getManager()); } |