Skip to content

Commit 3d56ea0

Browse files
authored
[clang][NFC] Fix FieldDecl::isUnnamedBitfield() capitalization (#89048)
We always capitalize bitfield as "BitField".
1 parent fbca90b commit 3d56ea0

29 files changed

+74
-71
lines changed

clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
444444
if (!F->hasInClassInitializer() &&
445445
utils::type_traits::isTriviallyDefaultConstructible(F->getType(),
446446
Context) &&
447-
!isEmpty(Context, F->getType()) && !F->isUnnamedBitfield() &&
447+
!isEmpty(Context, F->getType()) && !F->isUnnamedBitField() &&
448448
!AnyMemberHasInitPerUnion)
449449
FieldsToInit.insert(F);
450450
});

clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ getAllNamedFields(const CXXRecordDecl *Record) {
2626
std::set<const FieldDecl *> Result;
2727
for (const auto *Field : Record->fields()) {
2828
// Static data members are not in this range.
29-
if (Field->isUnnamedBitfield())
29+
if (Field->isUnnamedBitField())
3030
continue;
3131
Result.insert(Field);
3232
}

clang-tools-extra/clang-tidy/utils/ExceptionSpecAnalyzer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ ExceptionSpecAnalyzer::analyzeRecord(const CXXRecordDecl *RecordDecl,
9999
}
100100

101101
for (const auto *FDecl : RecordDecl->fields())
102-
if (!FDecl->isInvalidDecl() && !FDecl->isUnnamedBitfield()) {
102+
if (!FDecl->isInvalidDecl() && !FDecl->isUnnamedBitField()) {
103103
State Result = analyzeFieldDecl(FDecl, Kind);
104104
if (Result == State::Throwing || Result == State::Unknown)
105105
return Result;

clang/include/clang/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3149,7 +3149,7 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
31493149
bool isBitField() const { return BitField; }
31503150

31513151
/// Determines whether this is an unnamed bitfield.
3152-
bool isUnnamedBitfield() const { return isBitField() && !getDeclName(); }
3152+
bool isUnnamedBitField() const { return isBitField() && !getDeclName(); }
31533153

31543154
/// Determines whether this field is a
31553155
/// representative for an anonymous struct or union. Such fields are

clang/lib/AST/APValue.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,8 @@ void APValue::printPretty(raw_ostream &Out, const PrintingPolicy &Policy,
908908
for (const auto *FI : RD->fields()) {
909909
if (!First)
910910
Out << ", ";
911-
if (FI->isUnnamedBitfield()) continue;
911+
if (FI->isUnnamedBitField())
912+
continue;
912913
getStructField(FI->getFieldIndex()).
913914
printPretty(Out, Policy, FI->getType(), Ctx);
914915
First = false;

clang/lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2684,7 +2684,7 @@ getSubobjectSizeInBits(const FieldDecl *Field, const ASTContext &Context,
26842684
if (Field->isBitField()) {
26852685
// If we have explicit padding bits, they don't contribute bits
26862686
// to the actual object representation, so return 0.
2687-
if (Field->isUnnamedBitfield())
2687+
if (Field->isUnnamedBitField())
26882688
return 0;
26892689

26902690
int64_t BitfieldSize = Field->getBitWidthValue(Context);

clang/lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4597,7 +4597,7 @@ unsigned FieldDecl::getBitWidthValue(const ASTContext &Ctx) const {
45974597
}
45984598

45994599
bool FieldDecl::isZeroLengthBitField(const ASTContext &Ctx) const {
4600-
return isUnnamedBitfield() && !getBitWidth()->isValueDependent() &&
4600+
return isUnnamedBitField() && !getBitWidth()->isValueDependent() &&
46014601
getBitWidthValue(Ctx) == 0;
46024602
}
46034603

clang/lib/AST/DeclCXX.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
668668
for (auto *FD : X->fields()) {
669669
// FIXME: Should we really care about the type of the first non-static
670670
// data member of a non-union if there are preceding unnamed bit-fields?
671-
if (FD->isUnnamedBitfield())
671+
if (FD->isUnnamedBitField())
672672
continue;
673673

674674
if (!IsFirstField && !FD->isZeroSize(Ctx))
@@ -947,7 +947,7 @@ void CXXRecordDecl::addedMember(Decl *D) {
947947
// A declaration for a bit-field that omits the identifier declares an
948948
// unnamed bit-field. Unnamed bit-fields are not members and cannot be
949949
// initialized.
950-
if (Field->isUnnamedBitfield()) {
950+
if (Field->isUnnamedBitField()) {
951951
// C++ [meta.unary.prop]p4: [LWG2358]
952952
// T is a class type [...] with [...] no unnamed bit-fields of non-zero
953953
// length
@@ -3469,7 +3469,8 @@ static bool isValidStructGUID(ASTContext &Ctx, QualType T) {
34693469
return false;
34703470
auto MatcherIt = Fields.begin();
34713471
for (const FieldDecl *FD : RD->fields()) {
3472-
if (FD->isUnnamedBitfield()) continue;
3472+
if (FD->isUnnamedBitField())
3473+
continue;
34733474
if (FD->isBitField() || MatcherIt == Fields.end() ||
34743475
!(*MatcherIt)(FD->getType()))
34753476
return false;

clang/lib/AST/Expr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,7 @@ const FieldDecl *CastExpr::getTargetFieldForToUnionCast(const RecordDecl *RD,
20442044
for (Field = RD->field_begin(), FieldEnd = RD->field_end();
20452045
Field != FieldEnd; ++Field) {
20462046
if (Ctx.hasSameUnqualifiedType(Field->getType(), OpType) &&
2047-
!Field->isUnnamedBitfield()) {
2047+
!Field->isUnnamedBitField()) {
20482048
return *Field;
20492049
}
20502050
}
@@ -3393,7 +3393,7 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef,
33933393
continue;
33943394

33953395
// Don't emit anonymous bitfields, they just affect layout.
3396-
if (Field->isUnnamedBitfield())
3396+
if (Field->isUnnamedBitField())
33973397
continue;
33983398

33993399
if (ElementNo < ILE->getNumInits()) {

clang/lib/AST/ExprConstant.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,7 +2492,7 @@ static bool CheckEvaluationResult(CheckEvaluationResultKind CERK,
24922492
}
24932493
}
24942494
for (const auto *I : RD->fields()) {
2495-
if (I->isUnnamedBitfield())
2495+
if (I->isUnnamedBitField())
24962496
continue;
24972497

24982498
if (!CheckEvaluationResult(CERK, Info, DiagLoc, I->getType(),
@@ -3529,7 +3529,7 @@ static bool isReadByLvalueToRvalueConversion(const CXXRecordDecl *RD) {
35293529
return false;
35303530

35313531
for (auto *Field : RD->fields())
3532-
if (!Field->isUnnamedBitfield() &&
3532+
if (!Field->isUnnamedBitField() &&
35333533
isReadByLvalueToRvalueConversion(Field->getType()))
35343534
return true;
35353535

@@ -4898,7 +4898,7 @@ static bool handleDefaultInitValue(QualType T, APValue &Result) {
48984898
handleDefaultInitValue(I->getType(), Result.getStructBase(Index));
48994899

49004900
for (const auto *I : RD->fields()) {
4901-
if (I->isUnnamedBitfield())
4901+
if (I->isUnnamedBitField())
49024902
continue;
49034903
Success &= handleDefaultInitValue(
49044904
I->getType(), Result.getStructField(I->getFieldIndex()));
@@ -6436,7 +6436,7 @@ static bool HandleConstructorCall(const Expr *E, const LValue &This,
64366436
// Default-initialize any fields with no explicit initializer.
64376437
for (; !declaresSameEntity(*FieldIt, FD); ++FieldIt) {
64386438
assert(FieldIt != RD->field_end() && "missing field?");
6439-
if (!FieldIt->isUnnamedBitfield())
6439+
if (!FieldIt->isUnnamedBitField())
64406440
Success &= handleDefaultInitValue(
64416441
FieldIt->getType(),
64426442
Result.getStructField(FieldIt->getFieldIndex()));
@@ -6546,7 +6546,7 @@ static bool HandleConstructorCall(const Expr *E, const LValue &This,
65466546
// Default-initialize any remaining fields.
65476547
if (!RD->isUnion()) {
65486548
for (; FieldIt != RD->field_end(); ++FieldIt) {
6549-
if (!FieldIt->isUnnamedBitfield())
6549+
if (!FieldIt->isUnnamedBitField())
65506550
Success &= handleDefaultInitValue(
65516551
FieldIt->getType(),
65526552
Result.getStructField(FieldIt->getFieldIndex()));
@@ -6708,7 +6708,7 @@ static bool HandleDestructionImpl(EvalInfo &Info, SourceRange CallRange,
67086708
// fields first and then walk them backwards.
67096709
SmallVector<FieldDecl*, 16> Fields(RD->fields());
67106710
for (const FieldDecl *FD : llvm::reverse(Fields)) {
6711-
if (FD->isUnnamedBitfield())
6711+
if (FD->isUnnamedBitField())
67126712
continue;
67136713

67146714
LValue Subobject = This;
@@ -10220,7 +10220,7 @@ static bool HandleClassZeroInitialization(EvalInfo &Info, const Expr *E,
1022010220

1022110221
for (const auto *I : RD->fields()) {
1022210222
// -- if T is a reference type, no initialization is performed.
10223-
if (I->isUnnamedBitfield() || I->getType()->isReferenceType())
10223+
if (I->isUnnamedBitField() || I->getType()->isReferenceType())
1022410224
continue;
1022510225

1022610226
LValue Subobject = This;
@@ -10243,7 +10243,7 @@ bool RecordExprEvaluator::ZeroInitialization(const Expr *E, QualType T) {
1024310243
// C++11 [dcl.init]p5: If T is a (possibly cv-qualified) union type, the
1024410244
// object's first non-static named data member is zero-initialized
1024510245
RecordDecl::field_iterator I = RD->field_begin();
10246-
while (I != RD->field_end() && (*I)->isUnnamedBitfield())
10246+
while (I != RD->field_end() && (*I)->isUnnamedBitField())
1024710247
++I;
1024810248
if (I == RD->field_end()) {
1024910249
Result = APValue((const FieldDecl*)nullptr);
@@ -10390,7 +10390,7 @@ bool RecordExprEvaluator::VisitCXXParenListOrInitListExpr(
1039010390
for (const auto *Field : RD->fields()) {
1039110391
// Anonymous bit-fields are not considered members of the class for
1039210392
// purposes of aggregate initialization.
10393-
if (Field->isUnnamedBitfield())
10393+
if (Field->isUnnamedBitField())
1039410394
continue;
1039510395

1039610396
LValue Subobject = This;

0 commit comments

Comments
 (0)