[clang] [analyzer] Compute length of string literal initializers (#66990) (PR #68368)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 9 15:13:58 PDT 2023


================
@@ -97,6 +97,17 @@ void strlen_constant2(char x) {
   clang_analyzer_eval(strlen(a) == 3); // expected-warning{{UNKNOWN}}
 }
 
+const char *const global_str_ptr = "abcd";
----------------
Xazax-hun wrote:

What about a non-const global pointer? Could you add a test making sure we do not calculate the wrong size in that case?

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


More information about the cfe-commits mailing list