[clang] [clang][analyzer] Model function addresses in constant initializers (PR #217608)
Radovan Božić via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 24 06:29:43 PDT 2026
================
@@ -0,0 +1,80 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection \
+// RUN: -analyze-function=test_function_pointer_forms -verify=forms %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection \
+// RUN: -analyze-function=test_mutable_pointer -verify=mutable %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection \
+// RUN: -analyze-function=test_no_false_positive -verify=fp %s
+
+void clang_analyzer_checkInlined(int);
+void clang_analyzer_eval(int);
+
+typedef void (*callback)(unsigned);
+
+static void decay_target(unsigned value) {
+ clang_analyzer_checkInlined(value == 1); // forms-warning{{TRUE}}
+}
+
+static callback const decayCallback = decay_target;
----------------
bozicrHT wrote:
There is test for that bellow: `static callback mutableCallback = decay_target;`
https://github.com/llvm/llvm-project/pull/217608
More information about the cfe-commits
mailing list