Skip to content

Commit f25ceba

Browse files
committed
[CIR][NFC] Fix maybe_unused build issues
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 a99e32b commit f25ceba

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clang/lib/CIR/CodeGen/CIRGenValue.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ 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+
[[maybe_unused]]
310311
LLVM_PREFERRED_TYPE(bool)
311-
[[maybe_unused]] unsigned destructedFlag : 1;
312+
unsigned destructedFlag : 1;
312313

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

332334
/// This is set to true if the tail padding of this slot might overlap
333335
/// another object that may have already been initialized (and whose
334336
/// value must be preserved by this initialization). If so, we may only
335337
/// store up to the dsize of the type. Otherwise we can widen stores to
336338
/// the size of the type.
339+
[[maybe_unused]]
337340
LLVM_PREFERRED_TYPE(bool)
338-
[[maybe_unused]] unsigned overlapFlag : 1;
341+
unsigned overlapFlag : 1;
339342

340343
public:
341344
enum IsDestructed_t { IsNotDestructed, IsDestructed };

0 commit comments

Comments
 (0)