[clang] [-Wunsafe-buffer-usage] Separate flag for format-attributed functions (PR #175749)

Ziqing Luo via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 16 16:26:09 PST 2026


================
@@ -2523,7 +2523,12 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler {
   void handleUnsafeLibcCall(const CallExpr *Call, unsigned PrintfInfo,
                             ASTContext &Ctx,
                             const Expr *UnsafeArg = nullptr) override {
-    S.Diag(Call->getBeginLoc(), diag::warn_unsafe_buffer_libc_call)
+    unsigned DiagID = diag::warn_unsafe_buffer_libc_call;
+    if (PrintfInfo & 0x8) {
----------------
ziqingluo-90 wrote:

Please add some comments to explain 0x8 here.  Maybe it's time to refactor `PrintfInfo ` to an `enum` here (in another patch of course).

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


More information about the cfe-commits mailing list