[clang] [clang-tools-extra] [clang][NFC] Fix FieldDecl::isUnnamedBitfield() capitalization (PR #89048)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 17 04:26:43 PDT 2024
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/89048
>From 5e4b24933180f012573785fa5747bf37efd26fad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Wed, 17 Apr 2024 12:53:49 +0200
Subject: [PATCH] [clang][NFC] Fix FieldDecl::isUnnamedBitfield()
capitalization
We always capitalize bitfield as "BitField".
---
.../ProTypeMemberInitCheck.cpp | 2 +-
.../modernize/UseEqualsDefaultCheck.cpp | 2 +-
.../utils/ExceptionSpecAnalyzer.cpp | 2 +-
clang/include/clang/AST/Decl.h | 2 +-
clang/lib/AST/APValue.cpp | 3 ++-
clang/lib/AST/ASTContext.cpp | 2 +-
clang/lib/AST/Decl.cpp | 2 +-
clang/lib/AST/DeclCXX.cpp | 7 +++---
clang/lib/AST/Expr.cpp | 4 ++--
clang/lib/AST/ExprConstant.cpp | 18 +++++++-------
clang/lib/AST/Interp/EvaluationResult.cpp | 2 +-
clang/lib/AST/ItaniumMangle.cpp | 8 +++----
clang/lib/AST/MicrosoftMangle.cpp | 2 +-
clang/lib/Analysis/FlowSensitive/ASTOps.cpp | 2 +-
clang/lib/Analysis/UninitializedValues.cpp | 2 +-
clang/lib/CodeGen/ABIInfoImpl.cpp | 2 +-
clang/lib/CodeGen/CGCall.cpp | 2 +-
clang/lib/CodeGen/CGExpr.cpp | 2 +-
clang/lib/CodeGen/CGExprAgg.cpp | 8 ++++---
clang/lib/CodeGen/CGExprCXX.cpp | 2 +-
clang/lib/CodeGen/CGExprConstant.cpp | 4 ++--
clang/lib/CodeGen/CodeGenTBAA.cpp | 2 +-
clang/lib/CodeGen/Targets/X86.cpp | 4 ++--
clang/lib/Sema/SemaChecking.cpp | 2 +-
clang/lib/Sema/SemaDecl.cpp | 2 +-
clang/lib/Sema/SemaDeclCXX.cpp | 24 +++++++++----------
clang/lib/Sema/SemaInit.cpp | 24 +++++++++----------
.../Checkers/ObjCUnusedIVarsChecker.cpp | 3 +--
clang/lib/StaticAnalyzer/Core/RegionStore.cpp | 4 ++--
29 files changed, 74 insertions(+), 71 deletions(-)
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
index 855c4a2efc373e..9c3c7cc70c187b 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -444,7 +444,7 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
if (!F->hasInClassInitializer() &&
utils::type_traits::isTriviallyDefaultConstructible(F->getType(),
Context) &&
- !isEmpty(Context, F->getType()) && !F->isUnnamedBitfield() &&
+ !isEmpty(Context, F->getType()) && !F->isUnnamedBitField() &&
!AnyMemberHasInitPerUnion)
FieldsToInit.insert(F);
});
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
index 5134eb51a03226..93151024064b42 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
@@ -26,7 +26,7 @@ getAllNamedFields(const CXXRecordDecl *Record) {
std::set<const FieldDecl *> Result;
for (const auto *Field : Record->fields()) {
// Static data members are not in this range.
- if (Field->isUnnamedBitfield())
+ if (Field->isUnnamedBitField())
continue;
Result.insert(Field);
}
diff --git a/clang-tools-extra/clang-tidy/utils/ExceptionSpecAnalyzer.cpp b/clang-tools-extra/clang-tidy/utils/ExceptionSpecAnalyzer.cpp
index 1dde0490517852..4a9426ee7e8bbb 100644
--- a/clang-tools-extra/clang-tidy/utils/ExceptionSpecAnalyzer.cpp
+++ b/clang-tools-extra/clang-tidy/utils/ExceptionSpecAnalyzer.cpp
@@ -99,7 +99,7 @@ ExceptionSpecAnalyzer::analyzeRecord(const CXXRecordDecl *RecordDecl,
}
for (const auto *FDecl : RecordDecl->fields())
- if (!FDecl->isInvalidDecl() && !FDecl->isUnnamedBitfield()) {
+ if (!FDecl->isInvalidDecl() && !FDecl->isUnnamedBitField()) {
State Result = analyzeFieldDecl(FDecl, Kind);
if (Result == State::Throwing || Result == State::Unknown)
return Result;
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 01af50ca694fdd..fe8fe5574a5ea0 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -3149,7 +3149,7 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
bool isBitField() const { return BitField; }
/// Determines whether this is an unnamed bitfield.
- bool isUnnamedBitfield() const { return isBitField() && !getDeclName(); }
+ bool isUnnamedBitField() const { return isBitField() && !getDeclName(); }
/// Determines whether this field is a
/// representative for an anonymous struct or union. Such fields are
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index d8042321319a67..8c77b563657d90 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -908,7 +908,8 @@ void APValue::printPretty(raw_ostream &Out, const PrintingPolicy &Policy,
for (const auto *FI : RD->fields()) {
if (!First)
Out << ", ";
- if (FI->isUnnamedBitfield()) continue;
+ if (FI->isUnnamedBitField())
+ continue;
getStructField(FI->getFieldIndex()).
printPretty(Out, Policy, FI->getType(), Ctx);
First = false;
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 6ce233704a5885..68a86de2f46466 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -2684,7 +2684,7 @@ getSubobjectSizeInBits(const FieldDecl *Field, const ASTContext &Context,
if (Field->isBitField()) {
// If we have explicit padding bits, they don't contribute bits
// to the actual object representation, so return 0.
- if (Field->isUnnamedBitfield())
+ if (Field->isUnnamedBitField())
return 0;
int64_t BitfieldSize = Field->getBitWidthValue(Context);
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 33b6f8611f2162..169a6333c14f6e 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -4597,7 +4597,7 @@ unsigned FieldDecl::getBitWidthValue(const ASTContext &Ctx) const {
}
bool FieldDecl::isZeroLengthBitField(const ASTContext &Ctx) const {
- return isUnnamedBitfield() && !getBitWidth()->isValueDependent() &&
+ return isUnnamedBitField() && !getBitWidth()->isValueDependent() &&
getBitWidthValue(Ctx) == 0;
}
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 645ec2f7563bca..00cc857f5e7379 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -668,7 +668,7 @@ bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
for (auto *FD : X->fields()) {
// FIXME: Should we really care about the type of the first non-static
// data member of a non-union if there are preceding unnamed bit-fields?
- if (FD->isUnnamedBitfield())
+ if (FD->isUnnamedBitField())
continue;
if (!IsFirstField && !FD->isZeroSize(Ctx))
@@ -947,7 +947,7 @@ void CXXRecordDecl::addedMember(Decl *D) {
// A declaration for a bit-field that omits the identifier declares an
// unnamed bit-field. Unnamed bit-fields are not members and cannot be
// initialized.
- if (Field->isUnnamedBitfield()) {
+ if (Field->isUnnamedBitField()) {
// C++ [meta.unary.prop]p4: [LWG2358]
// T is a class type [...] with [...] no unnamed bit-fields of non-zero
// length
@@ -3469,7 +3469,8 @@ static bool isValidStructGUID(ASTContext &Ctx, QualType T) {
return false;
auto MatcherIt = Fields.begin();
for (const FieldDecl *FD : RD->fields()) {
- if (FD->isUnnamedBitfield()) continue;
+ if (FD->isUnnamedBitField())
+ continue;
if (FD->isBitField() || MatcherIt == Fields.end() ||
!(*MatcherIt)(FD->getType()))
return false;
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 07c9f287dd0767..9eec7edc9d1a3e 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -2044,7 +2044,7 @@ const FieldDecl *CastExpr::getTargetFieldForToUnionCast(const RecordDecl *RD,
for (Field = RD->field_begin(), FieldEnd = RD->field_end();
Field != FieldEnd; ++Field) {
if (Ctx.hasSameUnqualifiedType(Field->getType(), OpType) &&
- !Field->isUnnamedBitfield()) {
+ !Field->isUnnamedBitField()) {
return *Field;
}
}
@@ -3393,7 +3393,7 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef,
continue;
// Don't emit anonymous bitfields, they just affect layout.
- if (Field->isUnnamedBitfield())
+ if (Field->isUnnamedBitField())
continue;
if (ElementNo < ILE->getNumInits()) {
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 88c8eaf6ef9b6e..73ae8d8efb23a2 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -2492,7 +2492,7 @@ static bool CheckEvaluationResult(CheckEvaluationResultKind CERK,
}
}
for (const auto *I : RD->fields()) {
- if (I->isUnnamedBitfield())
+ if (I->isUnnamedBitField())
continue;
if (!CheckEvaluationResult(CERK, Info, DiagLoc, I->getType(),
@@ -3529,7 +3529,7 @@ static bool isReadByLvalueToRvalueConversion(const CXXRecordDecl *RD) {
return false;
for (auto *Field : RD->fields())
- if (!Field->isUnnamedBitfield() &&
+ if (!Field->isUnnamedBitField() &&
isReadByLvalueToRvalueConversion(Field->getType()))
return true;
@@ -4898,7 +4898,7 @@ static bool handleDefaultInitValue(QualType T, APValue &Result) {
handleDefaultInitValue(I->getType(), Result.getStructBase(Index));
for (const auto *I : RD->fields()) {
- if (I->isUnnamedBitfield())
+ if (I->isUnnamedBitField())
continue;
Success &= handleDefaultInitValue(
I->getType(), Result.getStructField(I->getFieldIndex()));
@@ -6436,7 +6436,7 @@ static bool HandleConstructorCall(const Expr *E, const LValue &This,
// Default-initialize any fields with no explicit initializer.
for (; !declaresSameEntity(*FieldIt, FD); ++FieldIt) {
assert(FieldIt != RD->field_end() && "missing field?");
- if (!FieldIt->isUnnamedBitfield())
+ if (!FieldIt->isUnnamedBitField())
Success &= handleDefaultInitValue(
FieldIt->getType(),
Result.getStructField(FieldIt->getFieldIndex()));
@@ -6546,7 +6546,7 @@ static bool HandleConstructorCall(const Expr *E, const LValue &This,
// Default-initialize any remaining fields.
if (!RD->isUnion()) {
for (; FieldIt != RD->field_end(); ++FieldIt) {
- if (!FieldIt->isUnnamedBitfield())
+ if (!FieldIt->isUnnamedBitField())
Success &= handleDefaultInitValue(
FieldIt->getType(),
Result.getStructField(FieldIt->getFieldIndex()));
@@ -6708,7 +6708,7 @@ static bool HandleDestructionImpl(EvalInfo &Info, SourceRange CallRange,
// fields first and then walk them backwards.
SmallVector<FieldDecl*, 16> Fields(RD->fields());
for (const FieldDecl *FD : llvm::reverse(Fields)) {
- if (FD->isUnnamedBitfield())
+ if (FD->isUnnamedBitField())
continue;
LValue Subobject = This;
@@ -10220,7 +10220,7 @@ static bool HandleClassZeroInitialization(EvalInfo &Info, const Expr *E,
for (const auto *I : RD->fields()) {
// -- if T is a reference type, no initialization is performed.
- if (I->isUnnamedBitfield() || I->getType()->isReferenceType())
+ if (I->isUnnamedBitField() || I->getType()->isReferenceType())
continue;
LValue Subobject = This;
@@ -10243,7 +10243,7 @@ bool RecordExprEvaluator::ZeroInitialization(const Expr *E, QualType T) {
// C++11 [dcl.init]p5: If T is a (possibly cv-qualified) union type, the
// object's first non-static named data member is zero-initialized
RecordDecl::field_iterator I = RD->field_begin();
- while (I != RD->field_end() && (*I)->isUnnamedBitfield())
+ while (I != RD->field_end() && (*I)->isUnnamedBitField())
++I;
if (I == RD->field_end()) {
Result = APValue((const FieldDecl*)nullptr);
@@ -10390,7 +10390,7 @@ bool RecordExprEvaluator::VisitCXXParenListOrInitListExpr(
for (const auto *Field : RD->fields()) {
// Anonymous bit-fields are not considered members of the class for
// purposes of aggregate initialization.
- if (Field->isUnnamedBitfield())
+ if (Field->isUnnamedBitField())
continue;
LValue Subobject = This;
diff --git a/clang/lib/AST/Interp/EvaluationResult.cpp b/clang/lib/AST/Interp/EvaluationResult.cpp
index d567b551f7f6fc..e92d686c724cc8 100644
--- a/clang/lib/AST/Interp/EvaluationResult.cpp
+++ b/clang/lib/AST/Interp/EvaluationResult.cpp
@@ -105,7 +105,7 @@ static bool CheckFieldsInitialized(InterpState &S, SourceLocation Loc,
Result &= CheckFieldsInitialized(S, Loc, FieldPtr, FieldPtr.getRecord());
} else if (FieldType->isIncompleteArrayType()) {
// Nothing to do here.
- } else if (F.Decl->isUnnamedBitfield()) {
+ } else if (F.Decl->isUnnamedBitField()) {
// Nothing do do here.
} else if (FieldType->isArrayType()) {
const auto *CAT =
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index d632c697fa20db..c3b98d2d2149cb 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -6176,7 +6176,7 @@ static bool isZeroInitialized(QualType T, const APValue &V) {
}
I = 0;
for (const FieldDecl *FD : RD->fields()) {
- if (!FD->isUnnamedBitfield() &&
+ if (!FD->isUnnamedBitField() &&
!isZeroInitialized(FD->getType(), V.getStructField(I)))
return false;
++I;
@@ -6189,7 +6189,7 @@ static bool isZeroInitialized(QualType T, const APValue &V) {
assert(RD && "unexpected type for union value");
// Zero-initialization zeroes the first non-unnamed-bitfield field, if any.
for (const FieldDecl *FD : RD->fields()) {
- if (!FD->isUnnamedBitfield())
+ if (!FD->isUnnamedBitField())
return V.getUnionField() && declaresSameEntity(FD, V.getUnionField()) &&
isZeroInitialized(FD->getType(), V.getUnionValue());
}
@@ -6331,7 +6331,7 @@ void CXXNameMangler::mangleValueInTemplateArg(QualType T, const APValue &V,
llvm::SmallVector<const FieldDecl *, 16> Fields(RD->fields());
while (
!Fields.empty() &&
- (Fields.back()->isUnnamedBitfield() ||
+ (Fields.back()->isUnnamedBitField() ||
isZeroInitialized(Fields.back()->getType(),
V.getStructField(Fields.back()->getFieldIndex())))) {
Fields.pop_back();
@@ -6351,7 +6351,7 @@ void CXXNameMangler::mangleValueInTemplateArg(QualType T, const APValue &V,
for (unsigned I = 0, N = Bases.size(); I != N; ++I)
mangleValueInTemplateArg(Bases[I].getType(), V.getStructBase(I), false);
for (unsigned I = 0, N = Fields.size(); I != N; ++I) {
- if (Fields[I]->isUnnamedBitfield())
+ if (Fields[I]->isUnnamedBitField())
continue;
mangleValueInTemplateArg(Fields[I]->getType(),
V.getStructField(Fields[I]->getFieldIndex()),
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index a0bb04e69c9be8..36d611750ca48c 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -1933,7 +1933,7 @@ void MicrosoftCXXNameMangler::mangleTemplateArgValue(QualType T,
for (const CXXBaseSpecifier &B : RD->bases())
mangleTemplateArgValue(B.getType(), V.getStructBase(BaseIndex++), TAK);
for (const FieldDecl *FD : RD->fields())
- if (!FD->isUnnamedBitfield())
+ if (!FD->isUnnamedBitField())
mangleTemplateArgValue(FD->getType(),
V.getStructField(FD->getFieldIndex()), TAK,
/*WithScalarType*/ true);
diff --git a/clang/lib/Analysis/FlowSensitive/ASTOps.cpp b/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
index 75188aef4d1a43..1982c6c9f38305 100644
--- a/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
+++ b/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
@@ -101,7 +101,7 @@ getFieldsForInitListExpr(const InitListExpr *InitList) {
// fields to avoid mapping inits to the wrongs fields.
llvm::copy_if(
RD->fields(), std::back_inserter(Fields),
- [](const FieldDecl *Field) { return !Field->isUnnamedBitfield(); });
+ [](const FieldDecl *Field) { return !Field->isUnnamedBitField(); });
return Fields;
}
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp
index e9111ded64eb1f..bf2f7306186507 100644
--- a/clang/lib/Analysis/UninitializedValues.cpp
+++ b/clang/lib/Analysis/UninitializedValues.cpp
@@ -44,7 +44,7 @@ static bool recordIsNotEmpty(const RecordDecl *RD) {
// We consider a record decl to be empty if it contains only unnamed bit-
// fields, zero-width fields, and fields of empty record type.
for (const auto *FD : RD->fields()) {
- if (FD->isUnnamedBitfield())
+ if (FD->isUnnamedBitField())
continue;
if (FD->isZeroSize(FD->getASTContext()))
continue;
diff --git a/clang/lib/CodeGen/ABIInfoImpl.cpp b/clang/lib/CodeGen/ABIInfoImpl.cpp
index 3e34d82cb399ba..1e4d48e13c025f 100644
--- a/clang/lib/CodeGen/ABIInfoImpl.cpp
+++ b/clang/lib/CodeGen/ABIInfoImpl.cpp
@@ -247,7 +247,7 @@ Address CodeGen::emitMergePHI(CodeGenFunction &CGF, Address Addr1,
bool CodeGen::isEmptyField(ASTContext &Context, const FieldDecl *FD,
bool AllowArrays, bool AsIfNoUniqueAddr) {
- if (FD->isUnnamedBitfield())
+ if (FD->isUnnamedBitField())
return true;
QualType FT = FD->getType();
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 3f5463a9a70e9d..6c33cc17621f89 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3665,7 +3665,7 @@ static void setUsedBits(CodeGenModule &CGM, const RecordType *RTy, int Offset,
for (auto I = RD->field_begin(), E = RD->field_end(); I != E; ++I, ++Idx) {
const FieldDecl *F = *I;
- if (F->isUnnamedBitfield() || F->isZeroLengthBitField(Context) ||
+ if (F->isUnnamedBitField() || F->isZeroLengthBitField(Context) ||
F->getType()->isIncompleteArrayType())
continue;
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index cf696a1c9f560f..931cb391342ea2 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -4704,7 +4704,7 @@ unsigned CodeGenFunction::getDebugInfoFIndex(const RecordDecl *Rec,
for (auto *F : Rec->getDefinition()->fields()) {
if (I == FieldIndex)
break;
- if (F->isUnnamedBitfield())
+ if (F->isUnnamedBitField())
Skipped++;
I++;
}
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 1b9287ea239347..355fec42be4489 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -1755,7 +1755,9 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
// Make sure that it's really an empty and not a failure of
// semantic analysis.
for (const auto *Field : record->fields())
- assert((Field->isUnnamedBitfield() || Field->isAnonymousStructOrUnion()) && "Only unnamed bitfields or ananymous class allowed");
+ assert(
+ (Field->isUnnamedBitField() || Field->isAnonymousStructOrUnion()) &&
+ "Only unnamed bitfields or ananymous class allowed");
#endif
return;
}
@@ -1783,7 +1785,7 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
break;
// Always skip anonymous bitfields.
- if (field->isUnnamedBitfield())
+ if (field->isUnnamedBitField())
continue;
// We're done if we reach the end of the explicit initializers, we
@@ -1988,7 +1990,7 @@ static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF) {
if (Field->getType()->isIncompleteArrayType() ||
ILEElement == ILE->getNumInits())
break;
- if (Field->isUnnamedBitfield())
+ if (Field->isUnnamedBitField())
continue;
const Expr *E = ILE->getInit(ILEElement++);
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index a4fb673284ceca..673ccef84d6781 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -1235,7 +1235,7 @@ void CodeGenFunction::EmitNewArrayInitializer(
if (auto *CXXRD = dyn_cast<CXXRecordDecl>(RType->getDecl()))
NumElements = CXXRD->getNumBases();
for (auto *Field : RType->getDecl()->fields())
- if (!Field->isUnnamedBitfield())
+ if (!Field->isUnnamedBitField())
++NumElements;
// FIXME: Recurse into nested InitListExprs.
if (ILE->getNumInits() == NumElements)
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index 9f1b06eebf9ed0..c924660c5a91c8 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -706,7 +706,7 @@ bool ConstStructBuilder::Build(InitListExpr *ILE, bool AllowOverwrite) {
continue;
// Don't emit anonymous bitfields.
- if (Field->isUnnamedBitfield())
+ if (Field->isUnnamedBitField())
continue;
// Get the initializer. A struct can include fields without initializers,
@@ -840,7 +840,7 @@ bool ConstStructBuilder::Build(const APValue &Val, const RecordDecl *RD,
continue;
// Don't emit anonymous bitfields or zero-sized fields.
- if (Field->isUnnamedBitfield() || Field->isZeroSize(CGM.getContext()))
+ if (Field->isUnnamedBitField() || Field->isZeroSize(CGM.getContext()))
continue;
// Emit the value of the initializer.
diff --git a/clang/lib/CodeGen/CodeGenTBAA.cpp b/clang/lib/CodeGen/CodeGenTBAA.cpp
index da689ee6a13d70..284421f494711e 100644
--- a/clang/lib/CodeGen/CodeGenTBAA.cpp
+++ b/clang/lib/CodeGen/CodeGenTBAA.cpp
@@ -414,7 +414,7 @@ llvm::MDNode *CodeGenTBAA::getBaseTypeInfoHelper(const Type *Ty) {
});
}
for (FieldDecl *Field : RD->fields()) {
- if (Field->isZeroSize(Context) || Field->isUnnamedBitfield())
+ if (Field->isZeroSize(Context) || Field->isUnnamedBitField())
continue;
QualType FieldQTy = Field->getType();
llvm::MDNode *TypeNode = isValidBaseType(FieldQTy)
diff --git a/clang/lib/CodeGen/Targets/X86.cpp b/clang/lib/CodeGen/Targets/X86.cpp
index f04db56db3357d..94cf0d86f9bed7 100644
--- a/clang/lib/CodeGen/Targets/X86.cpp
+++ b/clang/lib/CodeGen/Targets/X86.cpp
@@ -2087,7 +2087,7 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, Class &Lo,
bool BitField = i->isBitField();
// Ignore padding bit-fields.
- if (BitField && i->isUnnamedBitfield())
+ if (BitField && i->isUnnamedBitField())
continue;
// AMD64-ABI 3.2.3p2: Rule 1. If the size of an object is larger than
@@ -2128,7 +2128,7 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, Class &Lo,
// structure to be passed in memory even if unaligned, and
// therefore they can straddle an eightbyte.
if (BitField) {
- assert(!i->isUnnamedBitfield());
+ assert(!i->isUnnamedBitField());
uint64_t Offset = OffsetBase + Layout.getFieldOffset(idx);
uint64_t Size = i->getBitWidthValue(getContext());
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 99b0a00083535e..69c54e28ac039b 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -622,7 +622,7 @@ struct BuiltinDumpStructGenerator {
for (auto *D : RD->decls()) {
auto *IFD = dyn_cast<IndirectFieldDecl>(D);
auto *FD = IFD ? IFD->getAnonField() : dyn_cast<FieldDecl>(D);
- if (!FD || FD->isUnnamedBitfield() || FD->isAnonymousStructOrUnion())
+ if (!FD || FD->isUnnamedBitField() || FD->isAnonymousStructOrUnion())
continue;
llvm::SmallString<20> Format = llvm::StringRef("%s%s %s ");
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 19abd5327b73aa..86320edbb4434b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -19683,7 +19683,7 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
E = Record->field_end();
(NonBitFields == 0 || ZeroSize) && I != E; ++I) {
IsEmpty = false;
- if (I->isUnnamedBitfield()) {
+ if (I->isUnnamedBitField()) {
if (!I->isZeroLengthBitField(Context))
ZeroSize = false;
} else {
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 8c6bae545bfd15..b6bfc75fb0270b 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -1453,7 +1453,7 @@ static bool checkMemberDecomposition(Sema &S, ArrayRef<BindingDecl*> Bindings,
auto DiagnoseBadNumberOfBindings = [&]() -> bool {
unsigned NumFields = llvm::count_if(
- RD->fields(), [](FieldDecl *FD) { return !FD->isUnnamedBitfield(); });
+ RD->fields(), [](FieldDecl *FD) { return !FD->isUnnamedBitField(); });
assert(Bindings.size() != NumFields);
S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings)
<< DecompType << (unsigned)Bindings.size() << NumFields << NumFields
@@ -1466,7 +1466,7 @@ static bool checkMemberDecomposition(Sema &S, ArrayRef<BindingDecl*> Bindings,
// E shall not have an anonymous union member, ...
unsigned I = 0;
for (auto *FD : RD->fields()) {
- if (FD->isUnnamedBitfield())
+ if (FD->isUnnamedBitField())
continue;
// All the non-static data members are required to be nameable, so they
@@ -2067,7 +2067,7 @@ static bool CheckConstexprCtorInitializer(Sema &SemaRef,
if (Field->isInvalidDecl())
return true;
- if (Field->isUnnamedBitfield())
+ if (Field->isUnnamedBitField())
return true;
// Anonymous unions with no variant members and empty anonymous structs do not
@@ -5509,7 +5509,7 @@ bool Sema::SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors,
// A declaration for a bit-field that omits the identifier declares an
// unnamed bit-field. Unnamed bit-fields are not members and cannot be
// initialized.
- if (F->isUnnamedBitfield())
+ if (F->isUnnamedBitField())
continue;
// If we're not generating the implicit copy/move constructor, then we'll
@@ -5638,7 +5638,7 @@ static void DiagnoseBaseOrMemInitializerOrder(
// 3. Direct fields.
for (auto *Field : ClassDecl->fields()) {
- if (Field->isUnnamedBitfield())
+ if (Field->isUnnamedBitField())
continue;
PopulateKeysForFields(Field, IdealInitKeys);
@@ -7030,7 +7030,7 @@ void Sema::CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record) {
!Record->isLambda()) {
bool Complained = false;
for (const auto *F : Record->fields()) {
- if (F->hasInClassInitializer() || F->isUnnamedBitfield())
+ if (F->hasInClassInitializer() || F->isUnnamedBitField())
continue;
if (F->getType()->isReferenceType() ||
@@ -8037,7 +8037,7 @@ class DefaultedComparisonVisitor {
for (FieldDecl *Field : Record->fields()) {
// C++23 [class.bit]p2:
// Unnamed bit-fields are not members ...
- if (Field->isUnnamedBitfield())
+ if (Field->isUnnamedBitField())
continue;
// Recursively expand anonymous structs.
if (Field->isAnonymousStructOrUnion()) {
@@ -9396,7 +9396,7 @@ struct SpecialMemberVisitor {
return true;
for (auto *F : RD->fields())
- if (!F->isInvalidDecl() && !F->isUnnamedBitfield() &&
+ if (!F->isInvalidDecl() && !F->isUnnamedBitField() &&
getDerived().visitField(F))
return true;
@@ -9741,7 +9741,7 @@ bool SpecialMemberDeletionInfo::shouldDeleteForAllConstMembers() {
AllFieldsAreConst) {
bool AnyFields = false;
for (auto *F : MD->getParent()->fields())
- if ((AnyFields = !F->isUnnamedBitfield()))
+ if ((AnyFields = !F->isUnnamedBitField()))
break;
if (!AnyFields)
return false;
@@ -10134,7 +10134,7 @@ static bool checkTrivialClassMembers(Sema &S, CXXRecordDecl *RD,
Sema::TrivialABIHandling TAH,
bool Diagnose) {
for (const auto *FI : RD->fields()) {
- if (FI->isInvalidDecl() || FI->isUnnamedBitfield())
+ if (FI->isInvalidDecl() || FI->isUnnamedBitField())
continue;
QualType FieldType = S.Context.getBaseElementType(FI->getType());
@@ -15201,7 +15201,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
for (auto *Field : ClassDecl->fields()) {
// FIXME: We should form some kind of AST representation for the implied
// memcpy in a union copy operation.
- if (Field->isUnnamedBitfield() || Field->getParent()->isUnion())
+ if (Field->isUnnamedBitField() || Field->getParent()->isUnion())
continue;
if (Field->isInvalidDecl()) {
@@ -15586,7 +15586,7 @@ void Sema::DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
for (auto *Field : ClassDecl->fields()) {
// FIXME: We should form some kind of AST representation for the implied
// memcpy in a union copy operation.
- if (Field->isUnnamedBitfield() || Field->getParent()->isUnion())
+ if (Field->isUnnamedBitField() || Field->getParent()->isUnion())
continue;
if (Field->isInvalidDecl()) {
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index e86f7578ff0c05..793e16df178914 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -849,7 +849,7 @@ InitListChecker::FillInEmptyInitializations(const InitializedEntity &Entity,
}
for (auto *Field : RDecl->fields()) {
- if (Field->isUnnamedBitfield())
+ if (Field->isUnnamedBitField())
continue;
if (hadError)
@@ -1027,7 +1027,7 @@ int InitListChecker::numStructUnionElements(QualType DeclType) {
if (auto *CXXRD = dyn_cast<CXXRecordDecl>(structDecl))
InitializableMembers += CXXRD->getNumBases();
for (const auto *Field : structDecl->fields())
- if (!Field->isUnnamedBitfield())
+ if (!Field->isUnnamedBitField())
++InitializableMembers;
if (structDecl->isUnion())
@@ -2175,7 +2175,7 @@ void InitListChecker::CheckStructUnionTypes(
// bitfield.
for (RecordDecl::field_iterator FieldEnd = RD->field_end();
Field != FieldEnd; ++Field) {
- if (!Field->isUnnamedBitfield()) {
+ if (!Field->isUnnamedBitField()) {
CheckEmptyInitializable(
InitializedEntity::InitializeMember(*Field, &Entity),
IList->getEndLoc());
@@ -2338,7 +2338,7 @@ void InitListChecker::CheckStructUnionTypes(
if (Field->getType()->isIncompleteArrayType())
break;
- if (Field->isUnnamedBitfield()) {
+ if (Field->isUnnamedBitField()) {
// Don't initialize unnamed bitfields, e.g. "int : 20;"
++Field;
continue;
@@ -2398,7 +2398,7 @@ void InitListChecker::CheckStructUnionTypes(
if (HasDesignatedInit && InitializedFields.count(*it))
continue;
- if (!it->isUnnamedBitfield() && !it->hasInClassInitializer() &&
+ if (!it->isUnnamedBitField() && !it->hasInClassInitializer() &&
!it->getType()->isIncompleteArrayType()) {
auto Diag = HasDesignatedInit
? diag::warn_missing_designated_field_initializers
@@ -2414,7 +2414,7 @@ void InitListChecker::CheckStructUnionTypes(
if (!StructuredList && Field != FieldEnd && !RD->isUnion() &&
!Field->getType()->isIncompleteArrayType()) {
for (; Field != FieldEnd && !hadError; ++Field) {
- if (!Field->isUnnamedBitfield() && !Field->hasInClassInitializer())
+ if (!Field->isUnnamedBitField() && !Field->hasInClassInitializer())
CheckEmptyInitializable(
InitializedEntity::InitializeMember(*Field, &Entity),
IList->getEndLoc());
@@ -2784,7 +2784,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
unsigned FieldIndex = NumBases;
for (auto *FI : RD->fields()) {
- if (FI->isUnnamedBitfield())
+ if (FI->isUnnamedBitField())
continue;
if (declaresSameEntity(KnownField, FI)) {
KnownField = FI;
@@ -2858,7 +2858,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
// Find the field that we just initialized.
FieldDecl *PrevField = nullptr;
for (auto FI = RD->field_begin(); FI != RD->field_end(); ++FI) {
- if (FI->isUnnamedBitfield())
+ if (FI->isUnnamedBitField())
continue;
if (*NextField != RD->field_end() &&
declaresSameEntity(*FI, **NextField))
@@ -2976,7 +2976,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
// If this the first designator, our caller will continue checking
// the rest of this struct/class/union subobject.
if (IsFirstDesignator) {
- if (Field != RD->field_end() && Field->isUnnamedBitfield())
+ if (Field != RD->field_end() && Field->isUnnamedBitField())
++Field;
if (NextField)
@@ -5585,7 +5585,7 @@ static void TryOrBuildParenListInitialization(
for (FieldDecl *FD : RD->fields()) {
// Unnamed bitfields should not be initialized at all, either with an arg
// or by default.
- if (FD->isUnnamedBitfield())
+ if (FD->isUnnamedBitField())
continue;
InitializedEntity SubEntity =
@@ -7930,7 +7930,7 @@ static void visitLocalsRetainedByInitializer(IndirectLocalPath &Path,
for (const auto *I : RD->fields()) {
if (Index >= ILE->getNumInits())
break;
- if (I->isUnnamedBitfield())
+ if (I->isUnnamedBitField())
continue;
Expr *SubInit = ILE->getInit(Index);
if (I->getType()->isReferenceType())
@@ -9532,7 +9532,7 @@ static bool DiagnoseUninitializedReference(Sema &S, SourceLocation Loc,
return false;
for (const auto *FI : RD->fields()) {
- if (FI->isUnnamedBitfield())
+ if (FI->isUnnamedBitField())
continue;
if (DiagnoseUninitializedReference(S, FI->getLocation(), FI->getType())) {
diff --git a/clang/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp
index 2f2df63468b4b1..23014ff954870d 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp
@@ -118,8 +118,7 @@ static void checkObjCUnusedIvar(const ObjCImplementationDecl *D,
// (d) are unnamed bitfields
if (Ivar->getAccessControl() != ObjCIvarDecl::Private ||
Ivar->hasAttr<UnusedAttr>() || Ivar->hasAttr<IBOutletAttr>() ||
- Ivar->hasAttr<IBOutletCollectionAttr>() ||
- Ivar->isUnnamedBitfield())
+ Ivar->hasAttr<IBOutletCollectionAttr>() || Ivar->isUnnamedBitField())
continue;
M[Ivar] = Unused;
diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
index 755a8c4b22fd9e..ebba181eb2d842 100644
--- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -2570,7 +2570,7 @@ std::optional<RegionBindingsRef> RegionStoreManager::tryBindSmallStruct(
return std::nullopt;
for (const auto *FD : RD->fields()) {
- if (FD->isUnnamedBitfield())
+ if (FD->isUnnamedBitField())
continue;
// If there are too many fields, or if any of the fields are aggregates,
@@ -2697,7 +2697,7 @@ RegionBindingsRef RegionStoreManager::bindStruct(RegionBindingsConstRef B,
break;
// Skip any unnamed bitfields to stay in sync with the initializers.
- if (FI->isUnnamedBitfield())
+ if (FI->isUnnamedBitField())
continue;
QualType FTy = FI->getType();
More information about the cfe-commits
mailing list