llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Imad Aldij (imdj)

<details>
<summary>Changes</summary>

Fix crash when ConditionBRVisitor::VisitTerminator is faced with `if consteval` 
which doesn't have the expected traditional condition

Close
- #<!-- -->139130

---
Full diff: https://github.com/llvm/llvm-project/pull/146859.diff


1 Files Affected:

- (modified) clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (+3) 


``````````diff
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp 
b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index 3686bd4488877..d81a3f5a2858b 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -2794,6 +2794,9 @@ PathDiagnosticPieceRef 
ConditionBRVisitor::VisitTerminator(
   default:
     return nullptr;
   case Stmt::IfStmtClass:
+    // Handle if consteval which doesn't have a traditional condition
+    if (cast<IfStmt>(Term)->isConsteval())
+      return nullptr;
     Cond = cast<IfStmt>(Term)->getCond();
     break;
   case Stmt::ConditionalOperatorClass:

``````````

</details>


https://github.com/llvm/llvm-project/pull/146859
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to