[clang] [clang][AST] Mark APValue as LLVM_ATTRIBUTE_WARN_UNUSED (PR #226632)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 25 20:43:01 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/226632.diff
2 Files Affected:
- (modified) clang/include/clang/AST/APValue.h (+2-1)
- (modified) clang/lib/AST/ExprConstant.cpp (+1-2)
``````````diff
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 dea859382918b..3aba6e42f4c2f 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -20796,9 +20796,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],
``````````
</details>
https://github.com/llvm/llvm-project/pull/226632
More information about the cfe-commits
mailing list