[clang] 32e1360 - [CIR][NFC] Fix build problems with [[maybe_unused]] (#143994)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 12 16:16:17 PDT 2025
Author: Andy Kaylor
Date: 2025-06-12T16:16:14-07:00
New Revision: 32e1360aaa9fbf5e388f9d061fa004b02c0a1359
URL: https://github.com/llvm/llvm-project/commit/32e1360aaa9fbf5e388f9d061fa004b02c0a1359
DIFF: https://github.com/llvm/llvm-project/commit/32e1360aaa9fbf5e388f9d061fa004b02c0a1359.diff
LOG: [CIR][NFC] Fix build problems with [[maybe_unused]] (#143994)
A recent commit introduced the use of [[maybe_unused]] following
LLVM_PREFFERED_TYPE(bool) on a member variable declaration. I compiled
it with clang 14.0, which doesn't support the `preferred_type` attribute
so I didn't notice a problem. However, starting with clang 18.0, this
reports an error ("an attribute list cannot appear here") because of the
mixing of attribute styles.
This change fixes the problem by replacing [[maybe_unused]] with
LLVM_ATTRIBUTE_UNUSED.
Added:
Modified:
clang/lib/CIR/CodeGen/CIRGenValue.h
Removed:
################################################################################
diff --git a/clang/lib/CIR/CodeGen/CIRGenValue.h b/clang/lib/CIR/CodeGen/CIRGenValue.h
index 8f52fea31750c..258ae306f693d 100644
--- a/clang/lib/CIR/CodeGen/CIRGenValue.h
+++ b/clang/lib/CIR/CodeGen/CIRGenValue.h
@@ -271,7 +271,7 @@ class AggValueSlot {
/// destructor for the slot. Otherwise the code which constructs it should
/// push the appropriate cleanup.
LLVM_PREFERRED_TYPE(bool)
- [[maybe_unused]] unsigned destructedFlag : 1;
+ LLVM_ATTRIBUTE_UNUSED unsigned destructedFlag : 1;
/// This is set to true if the memory in the slot is known to be zero before
/// the assignment into it. This means that zero fields don't need to be set.
@@ -290,7 +290,7 @@ class AggValueSlot {
/// object, it's important that this flag never be set when
/// evaluating an expression which constructs such an object.
LLVM_PREFERRED_TYPE(bool)
- [[maybe_unused]] unsigned aliasedFlag : 1;
+ LLVM_ATTRIBUTE_UNUSED unsigned aliasedFlag : 1;
/// This is set to true if the tail padding of this slot might overlap
/// another object that may have already been initialized (and whose
@@ -298,7 +298,7 @@ class AggValueSlot {
/// store up to the dsize of the type. Otherwise we can widen stores to
/// the size of the type.
LLVM_PREFERRED_TYPE(bool)
- [[maybe_unused]] unsigned overlapFlag : 1;
+ LLVM_ATTRIBUTE_UNUSED unsigned overlapFlag : 1;
public:
enum IsDestructed_t { IsNotDestructed, IsDestructed };
More information about the cfe-commits
mailing list