forked from OSchip/llvm-project
In case of template specialization, do not try to delay emitting debug info for concrete type in -flimit-debug-info mode. This fixes some of the failures from bs15503.exp tests in gdb testsuite.
llvm-svn: 143227
This commit is contained in:
parent
d443641291
commit
fa59ac363e
|
@ -745,11 +745,27 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
|
|||
if (!Method->isStatic()) {
|
||||
// "this" pointer is always first argument.
|
||||
QualType ThisPtr = Method->getThisType(CGM.getContext());
|
||||
llvm::DIType ThisPtrType =
|
||||
DBuilder.createArtificialType(getOrCreateType(ThisPtr, Unit));
|
||||
|
||||
TypeCache[ThisPtr.getAsOpaquePtr()] = ThisPtrType;
|
||||
Elts.push_back(ThisPtrType);
|
||||
|
||||
const CXXRecordDecl *RD = Method->getParent();
|
||||
if (isa<ClassTemplateSpecializationDecl>(RD)) {
|
||||
// Create pointer type directly in this case.
|
||||
const PointerType *ThisPtrTy = cast<PointerType>(ThisPtr);
|
||||
QualType PointeeTy = ThisPtrTy->getPointeeType();
|
||||
unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy);
|
||||
uint64_t Size = CGM.getContext().getTargetInfo().getPointerWidth(AS);
|
||||
uint64_t Align = CGM.getContext().getTypeAlign(ThisPtrTy);
|
||||
llvm::DIType PointeeType = getOrCreateType(PointeeTy, Unit);
|
||||
llvm::DIType ThisPtrType =
|
||||
DBuilder.createArtificialType
|
||||
(DBuilder.createPointerType(PointeeType, Size, Align));
|
||||
TypeCache[ThisPtr.getAsOpaquePtr()] = ThisPtrType;
|
||||
Elts.push_back(ThisPtrType);
|
||||
} else {
|
||||
llvm::DIType ThisPtrType =
|
||||
DBuilder.createArtificialType(getOrCreateType(ThisPtr, Unit));
|
||||
TypeCache[ThisPtr.getAsOpaquePtr()] = ThisPtrType;
|
||||
Elts.push_back(ThisPtrType);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy rest of the arguments.
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// RUN: %clang -flimit-debug-info -emit-llvm -g -S %s -o - | FileCheck %s
|
||||
|
||||
// Check that this pointer type is TC<int>
|
||||
// CHECK: !10} ; [ DW_TAG_pointer_type
|
||||
// CHECK-NEXT: !10 ={{.*}}"TC<int>"
|
||||
|
||||
template<typename T>
|
||||
class TC {
|
||||
public:
|
||||
TC(const TC &) {}
|
||||
TC() {}
|
||||
};
|
||||
|
||||
TC<int> tci;
|
||||
|
Loading…
Reference in New Issue