[clang] 50f8025 - [clang][AST] Mark APValue as LLVM_ATTRIBUTE_WARN_UNUSED (#226632)

via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 26 22:18:57 PDT 2026


Author: Timm Baeder
Date: 2026-09-27T07:18:51+02:00
New Revision: 50f802581bd16b82bd68a9a4682cdbdc560368df

URL: https://github.com/llvm/llvm-project/commit/50f802581bd16b82bd68a9a4682cdbdc560368df
DIFF: https://github.com/llvm/llvm-project/commit/50f802581bd16b82bd68a9a4682cdbdc560368df.diff

LOG: [clang][AST] Mark APValue as LLVM_ATTRIBUTE_WARN_UNUSED (#226632)

Added: 
    

Modified: 
    clang/include/clang/AST/APValue.h
    clang/lib/AST/ExprConstant.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h
index c5c871ef953cb..ef25f99b48544 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -21,6 +21,7 @@
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/Support/AlignOf.h"
+#include "llvm/Support/Compiler.h"
 
 namespace clang {
 namespace serialization {
@@ -119,7 +120,7 @@ namespace clang {
 /// APValue - This class implements a discriminated union of [uninitialized]
 /// [APSInt] [APFloat], [Complex APSInt] [Complex APFloat], [Expr + Offset],
 /// [Vector: N * APValue], [Array: N * APValue]
-class APValue {
+class LLVM_ATTRIBUTE_WARN_UNUSED APValue {
   typedef llvm::APFixedPoint APFixedPoint;
   typedef llvm::APSInt APSInt;
   typedef llvm::APFloat APFloat;

diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 2df754dc9007f..72baa9406cdde 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -20828,9 +20828,8 @@ bool FloatExprEvaluator::VisitCastExpr(const CastExpr *E) {
     if (!hlslElementwiseCastHelper(Info, SubExpr, E->getType(), SrcVals,
                                    SrcTypes))
       return false;
-    APValue Val;
 
-    // cast our single element
+    // Cast our single element.
     const FPOptions FPO = E->getFPFeaturesInEffect(Info.Ctx.getLangOpts());
     APValue ResultVal;
     if (!handleScalarCast(Info, FPO, E, SrcTypes[0], E->getType(), SrcVals[0],


        


More information about the cfe-commits mailing list