[PATCH] D139737: [-Wunsafe-buffer-usage] Initiate Fix-it generation for local variable declarations

Jan Korous via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 1 20:15:38 PST 2023


jkorous added inline comments.


================
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:894
+    if (VD->getType()->isPointerType())
+      return fixVariableWithSpan(VD, Tracker, Ctx, Handler);
+    return {};
----------------
I believe we should add another condition here: `VD->isLocalVarDecl()` as we don't support globals (yet?).
We run the matcher with `any_ds` tag only on function bodies so we won't discover globals anyway and the `assert(It != Defs.end() && "Definition never discovered!");` would fail.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139737/new/

https://reviews.llvm.org/D139737



More information about the cfe-commits mailing list