[clang] [clang][analyzer] Ignore try-statements in dead code checker (PR #91675)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Mon May 13 23:55:18 PDT 2024
================
@@ -0,0 +1,12 @@
+// RUN: %clang_analyze_cc1 -verify %s -fcxx-exceptions -fexceptions -analyzer-checker=core -analyzer-checker=alpha.deadcode.UnreachableCode
+
+// expected-no-diagnostics
+
+void foo();
+
+void f4() {
+ try {
+ foo();
+ } catch (int) {
+ }
+}
----------------
steakhal wrote:
```suggestion
void fp_90162() {
try { // no-warning: The TryStmt shouldn't be unreachable.
foo();
} catch (int) {
foo(); // We assume that catch handlers are reachable.
}
}
```
https://github.com/llvm/llvm-project/pull/91675
More information about the cfe-commits
mailing list