summaryrefslogtreecommitdiff
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2025-07-18 13:26:00 -0700
committerPeter Collingbourne <peter@pcc.me.uk>2025-07-18 13:26:00 -0700
commit9bf3524731070cadc6175707314f3b6ca37190d5 (patch)
tree86dcab7604336b01ae938fe81062c29ff69efba8 /clang/lib/AST/Decl.cpp
parent3a84c15cc13b6daf8e812592898ab6c7f19091a9 (diff)
parent4f43f0606c3d7e1ce6d069583b5e59f036e112ce (diff)
Created using spr 1.3.6-beta.1
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 8855d0107dac..83fcd87aec2f 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -4677,11 +4677,14 @@ void FieldDecl::setLazyInClassInitializer(LazyDeclStmtPtr NewInit) {
Init = NewInit;
}
+bool FieldDecl::hasConstantIntegerBitWidth() const {
+ const auto *CE = dyn_cast_if_present<ConstantExpr>(getBitWidth());
+ return CE && CE->getAPValueResult().isInt();
+}
+
unsigned FieldDecl::getBitWidthValue() const {
assert(isBitField() && "not a bitfield");
- assert(isa<ConstantExpr>(getBitWidth()));
- assert(cast<ConstantExpr>(getBitWidth())->hasAPValueResult());
- assert(cast<ConstantExpr>(getBitWidth())->getAPValueResult().isInt());
+ assert(hasConstantIntegerBitWidth());
return cast<ConstantExpr>(getBitWidth())
->getAPValueResult()
.getInt()
@@ -5136,11 +5139,6 @@ RecordDecl *RecordDecl::CreateDeserialized(const ASTContext &C,
return R;
}
-bool RecordDecl::isInjectedClassName() const {
- return isImplicit() && getDeclName() && getDeclContext()->isRecord() &&
- cast<RecordDecl>(getDeclContext())->getDeclName() == getDeclName();
-}
-
bool RecordDecl::isLambda() const {
if (auto RD = dyn_cast<CXXRecordDecl>(this))
return RD->isLambda();