[clang] [clang][analyzer] Add StoreToImmutable checker (PR #150417)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 30 07:13:33 PDT 2025


================
@@ -0,0 +1,32 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.core.StoreToImmutable %s
+
+// Global const variable
+const int global_const = 42;
----------------
NagyDonat wrote:

@steakhal You are right that globals and locals are handled differently _by the checker implementation_, what we meant under "handled the same way" is the user experience. This is an example file that will be included in the documentation so we shouldn't highlight the global/local nature of variables if the user will see the same behavior (modifying `const` values or parts of them is reported) in either case.

https://github.com/llvm/llvm-project/pull/150417


More information about the cfe-commits mailing list