[clang] [clang][AST] Mark APValue as LLVM_ATTRIBUTE_WARN_UNUSED (PR #226632)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 25 20:42:14 PDT 2026
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/226632
None
>From ac2451f624b6f0d98dcc839fcf3ce5e0db703c44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Sat, 26 Sep 2026 05:41:12 +0200
Subject: [PATCH] [clang][AST] Mark APValue as LLVM_ATTRIBUTE_WARN_UNUSED
---
clang/include/clang/AST/APValue.h | 3 ++-
clang/lib/AST/ExprConstant.cpp | 3 +--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h
index c5c871ef953cb5..ef25f99b48544a 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 dea859382918b0..3aba6e42f4c2fb 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],
More information about the cfe-commits
mailing list