Hey Adrian - what's the reason we need the type's size for optimized debug info output? On Mar 1, 2015 2:11 PM, "Peter Collingbourne" <[email protected]> wrote:
> Author: pcc > Date: Sun Mar 1 16:07:04 2015 > New Revision: 230914 > > URL: http://llvm.org/viewvc/llvm-project?rev=230914&view=rev > Log: > DebugInfo: Give externally defined types a size and alignment where > possible. Fixes PR22736. > > Modified: > cfe/trunk/lib/CodeGen/CGDebugInfo.cpp > > cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp > > Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=230914&r1=230913&r2=230914&view=diff > > ============================================================================== > --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) > +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sun Mar 1 16:07:04 2015 > @@ -647,11 +647,19 @@ CGDebugInfo::getOrCreateRecordFwdDecl(co > unsigned Line = getLineNumber(RD->getLocation()); > StringRef RDName = getClassName(RD); > > + uint64_t Size = 0; > + uint64_t Align = 0; > + > + const RecordDecl *D = RD->getDefinition(); > + if (D && D->isCompleteDefinition()) { > + Size = CGM.getContext().getTypeSize(Ty); > + Align = CGM.getContext().getTypeAlign(Ty); > + } > > // Create the type. > SmallString<256> FullName = getUniqueTagTypeName(Ty, CGM, TheCU); > llvm::DICompositeType RetTy = DBuilder.createReplaceableCompositeType( > - getTagForRecord(RD), RDName, Ctx, DefUnit, Line, 0, 0, 0, > + getTagForRecord(RD), RDName, Ctx, DefUnit, Line, 0, Size, Align, > llvm::DIDescriptor::FlagFwdDecl, FullName); > ReplaceMap.emplace_back( > std::piecewise_construct, std::make_tuple(Ty), > > Modified: > cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp?rev=230914&r1=230913&r2=230914&view=diff > > ============================================================================== > --- > cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp > (original) > +++ > cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp > Sun Mar 1 16:07:04 2015 > @@ -99,3 +99,11 @@ template <> > struct k<int>; > template struct k<int>; > // CHECK-NOT: ; [ DW_TAG_structure_type ] [k<int>] > + > +template <typename T> > +struct l { > + int x; > +}; > +extern template class l<int>; > +l<int> li; > +// CHECK: [ DW_TAG_structure_type ] [l<int>] {{.*}}size {{[^0]}} > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
