[clang] [-Wunsafe-buffer-usage] Check isValueDependent before EvaluateAsBooleanCondition (PR #172091)

Ziqing Luo via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 12 14:02:14 PST 2025


================
@@ -156,6 +156,8 @@ void safe_examples(std::string s1, int *p) {
   snprintf(a, 10, "%s%d%s%p%s", __PRETTY_FUNCTION__, *p, "hello", s1.c_str());                // no warn
   snprintf(&c, 1, "%s%d%s%p%s", __PRETTY_FUNCTION__, *p, "hello", s1.c_str());                // no warn
   snprintf(nullptr, 0, "%s%d%s%p%s", __PRETTY_FUNCTION__, *p, "hello", s1.c_str());           // no warn
+
+  strlen(s1.c_str());
----------------
ziqingluo-90 wrote:

Test for the upstreaming code.

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


More information about the cfe-commits mailing list