diff options
author | Timm Bäder <tbaeder@redhat.com> | 2025-01-08 15:09:52 +0100 |
---|---|---|
committer | Timm Bäder <tbaeder@redhat.com> | 2025-01-08 15:09:52 +0100 |
commit | 59bdea24b09bca9332a7092b583ebf377efb0d50 (patch) | |
tree | 51536c49c6c6b105f74c37bc531c270139a53253 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | 346fad5c2c28d0cd39475ae979ee468a420ebed7 (diff) | |
download | llvm-59bdea24b09bca9332a7092b583ebf377efb0d50.zip llvm-59bdea24b09bca9332a7092b583ebf377efb0d50.tar.gz llvm-59bdea24b09bca9332a7092b583ebf377efb0d50.tar.bz2 |
Revert "[clang] Avoid re-evaluating field bitwidth (#117732)"
This reverts commit 81fc3add1e627c23b7270fe2739cdacc09063e54.
This breaks some LLDB tests, e.g.
SymbolFile/DWARF/x86/no_unique_address-with-bitfields.cpp:
lldb: ../llvm-project/clang/lib/AST/Decl.cpp:4604: unsigned int clang::FieldDecl::getBitWidthValue() const: Assertion `isa<ConstantExpr>(getBitWidth())' failed.
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index d7e5e95..560d4ce 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1721,7 +1721,8 @@ llvm::DIDerivedType *CGDebugInfo::createBitFieldSeparatorIfNeeded( assert(PreviousBitfield->isBitField()); - if (!PreviousBitfield->isZeroLengthBitField()) + ASTContext &Context = CGM.getContext(); + if (!PreviousBitfield->isZeroLengthBitField(Context)) return nullptr; QualType Ty = PreviousBitfield->getType(); @@ -3213,8 +3214,9 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, if (!FType->isIncompleteArrayType()) { // Bit size, align and offset of the type. - FieldSize = Field->isBitField() ? Field->getBitWidthValue() - : CGM.getContext().getTypeSize(FType); + FieldSize = Field->isBitField() + ? Field->getBitWidthValue(CGM.getContext()) + : CGM.getContext().getTypeSize(FType); FieldAlign = getTypeAlignIfRequired(FType, CGM.getContext()); } |