Skip to content

Commit e101afc

Browse files
authored
[CIR][NFC] Fix maybe_unused build issues (#163997)
This fixes a build failure that occurs with some versions of clang. There was a problem in clang, which has been fixed in more recent versions, where mixing GNU-style attributes with C++-style attributes caused a failure. A recent code change updated a few uses of `LLVM_ATTRIBUTE_UNUSED` to `[[maybe_unused]]`, triggering this problem. This change reorders the attributes in a way that avoids the issue.
1 parent 9324afb commit e101afc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

clang/lib/CIR/CodeGen/CIRGenValue.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ class AggValueSlot {
307307
/// This is set to true if some external code is responsible for setting up a
308308
/// destructor for the slot. Otherwise the code which constructs it should
309309
/// push the appropriate cleanup.
310-
LLVM_PREFERRED_TYPE(bool)
311-
[[maybe_unused]] unsigned destructedFlag : 1;
310+
[[maybe_unused]]
311+
LLVM_PREFERRED_TYPE(bool) unsigned destructedFlag : 1;
312312

313313
/// This is set to true if the memory in the slot is known to be zero before
314314
/// the assignment into it. This means that zero fields don't need to be set.
@@ -326,16 +326,16 @@ class AggValueSlot {
326326
/// over. Since it's invalid in general to memcpy a non-POD C++
327327
/// object, it's important that this flag never be set when
328328
/// evaluating an expression which constructs such an object.
329-
LLVM_PREFERRED_TYPE(bool)
330-
[[maybe_unused]] unsigned aliasedFlag : 1;
329+
[[maybe_unused]]
330+
LLVM_PREFERRED_TYPE(bool) unsigned aliasedFlag : 1;
331331

332332
/// This is set to true if the tail padding of this slot might overlap
333333
/// another object that may have already been initialized (and whose
334334
/// value must be preserved by this initialization). If so, we may only
335335
/// store up to the dsize of the type. Otherwise we can widen stores to
336336
/// the size of the type.
337-
LLVM_PREFERRED_TYPE(bool)
338-
[[maybe_unused]] unsigned overlapFlag : 1;
337+
[[maybe_unused]]
338+
LLVM_PREFERRED_TYPE(bool) unsigned overlapFlag : 1;
339339

340340
public:
341341
enum IsDestructed_t { IsNotDestructed, IsDestructed };

0 commit comments

Comments
 (0)