[clang] 9931357 - [-Wunsafe-buffer-usage] Fix warning after #102953

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 15 14:17:30 PDT 2024


Author: Fangrui Song
Date: 2024-08-15T14:17:26-07:00
New Revision: 99313575b6bb7d5acbe437c2022b6e5dc7f297f1

URL: https://github.com/llvm/llvm-project/commit/99313575b6bb7d5acbe437c2022b6e5dc7f297f1
DIFF: https://github.com/llvm/llvm-project/commit/99313575b6bb7d5acbe437c2022b6e5dc7f297f1.diff

LOG: [-Wunsafe-buffer-usage] Fix warning after #102953

Added: 
    

Modified: 
    clang/lib/Analysis/UnsafeBufferUsage.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index 95c288bfe3fd2f..da7446913f7c87 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -2797,9 +2797,8 @@ fixVariable(const VarDecl *VD, FixitStrategy::Kind K,
     return {};
   }
   case FixitStrategy::Kind::Array: {
-    if (VD->isLocalVarDecl())
-      if (auto CAT = Ctx.getAsConstantArrayType(VD->getType()))
-        return fixVariableWithArray(VD, Tracker, Ctx, Handler);
+    if (VD->isLocalVarDecl() && Ctx.getAsConstantArrayType(VD->getType()))
+      return fixVariableWithArray(VD, Tracker, Ctx, Handler);
 
     DEBUG_NOTE_DECL_FAIL(VD, " : not a local const-size array");
     return {};


        


More information about the cfe-commits mailing list