diff options
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 14 |
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(); |
