Author: Shafik Yaghmour
Date: 2025-04-23T13:46:06-07:00
New Revision: 112014ba67792e00ff719d640a5fddb79d78674d

URL: 
https://github.com/llvm/llvm-project/commit/112014ba67792e00ff719d640a5fddb79d78674d
DIFF: 
https://github.com/llvm/llvm-project/commit/112014ba67792e00ff719d640a5fddb79d78674d.diff

LOG: [Clang][NFC] Use temporary instead of one use local variable when creating 
APValue (#137029)

Static analysis flagged this code b/c we should have been using
std::move when passing by value since the value is not used anymore. In
this case the simpler fix is just to use a temporary value as many of
the other cases where we simply use MakeIntValue to then create an
APValue result from it.

Added: 
    

Modified: 
    clang/lib/Sema/SemaExprCXX.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index f5a10e0db85ad..72edb72ceb600 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -6147,9 +6147,8 @@ static APValue EvaluateSizeTTypeTrait(Sema &S, TypeTrait 
Kind,
       S.Diag(KWLoc, diag::err_arg_is_not_destructurable) << T << ArgRange;
       return APValue();
     }
-    llvm::APSInt V =
-        S.getASTContext().MakeIntValue(*Size, S.getASTContext().getSizeType());
-    return APValue{V};
+    return APValue(
+        S.getASTContext().MakeIntValue(*Size, 
S.getASTContext().getSizeType()));
     break;
   }
   default:


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to