Skip to content

Commit aa1f8c0

Browse files
andykaylorakuhlens
authored andcommitted
[CIR][NFC] Fix build problems with [[maybe_unused]] (llvm#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.
1 parent a4d77ef commit aa1f8c0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/lib/CIR/CodeGen/CIRGenValue.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class AggValueSlot {
271271
/// destructor for the slot. Otherwise the code which constructs it should
272272
/// push the appropriate cleanup.
273273
LLVM_PREFERRED_TYPE(bool)
274-
[[maybe_unused]] unsigned destructedFlag : 1;
274+
LLVM_ATTRIBUTE_UNUSED unsigned destructedFlag : 1;
275275

276276
/// This is set to true if the memory in the slot is known to be zero before
277277
/// the assignment into it. This means that zero fields don't need to be set.
@@ -290,15 +290,15 @@ class AggValueSlot {
290290
/// object, it's important that this flag never be set when
291291
/// evaluating an expression which constructs such an object.
292292
LLVM_PREFERRED_TYPE(bool)
293-
[[maybe_unused]] unsigned aliasedFlag : 1;
293+
LLVM_ATTRIBUTE_UNUSED unsigned aliasedFlag : 1;
294294

295295
/// This is set to true if the tail padding of this slot might overlap
296296
/// another object that may have already been initialized (and whose
297297
/// value must be preserved by this initialization). If so, we may only
298298
/// store up to the dsize of the type. Otherwise we can widen stores to
299299
/// the size of the type.
300300
LLVM_PREFERRED_TYPE(bool)
301-
[[maybe_unused]] unsigned overlapFlag : 1;
301+
LLVM_ATTRIBUTE_UNUSED unsigned overlapFlag : 1;
302302

303303
public:
304304
enum IsDestructed_t { IsNotDestructed, IsDestructed };

0 commit comments

Comments
 (0)