summaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer
diff options
context:
space:
mode:
authorKristof Umann <dkszelethus@gmail.com>2019-08-17 16:49:54 +0000
committerKristof Umann <dkszelethus@gmail.com>2019-08-17 16:49:54 +0000
commitc0d45f53c11aadc19b7f4fee07a549b6a849a293 (patch)
tree304d0573e17aafa50fa1bb81677a8bec73d5d6ed /lib/StaticAnalyzer
parent64cfbd580e794876bc4bacc7e6b1de6f07afc35a (diff)
downloadclang-c0d45f53c11aadc19b7f4fee07a549b6a849a293.tar.gz
[analyzer] Turn an assert into an if condition
Shocker, turns out that terminator conditions that are binary operators aren't always logical operators. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369195 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer')
-rw-r--r--lib/StaticAnalyzer/Core/BugReporterVisitors.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index 9850349f6b..de5af313bc 100644
--- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -1755,10 +1755,9 @@ static bool isAssertlikeBlock(const CFGBlock *B, ASTContext &Context) {
// B1, 'A && B' for B2, and 'A && B || C' for B3. Let's check whether we
// reached the end of the condition!
if (const Stmt *ElseCond = Else->getTerminatorCondition())
- if (isa<BinaryOperator>(ElseCond)) {
- assert(cast<BinaryOperator>(ElseCond)->isLogicalOp());
- return isAssertlikeBlock(Else, Context);
- }
+ if (const auto *BinOp = dyn_cast<BinaryOperator>(ElseCond))
+ if (BinOp->isLogicalOp())
+ return isAssertlikeBlock(Else, Context);
return false;
}