aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-02-16 01:11:51 +0000
committerDevang Patel <dpatel@apple.com>2011-02-16 01:11:51 +0000
commit34753802931fddcf57bd62c5b83bdca1a23017d7 (patch)
treebbce2f4b15d6a452217f0c8f1a098633ac18c52b /lib/CodeGen/CGDebugInfo.cpp
parent78bcd9139f4b35be75190446c95614120d9b4c09 (diff)
Simplify test to check an aggregate argument that has non trivial constructor or destructor.
This patch rewrites r125142. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 2debea1733..9296b42e77 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1741,8 +1741,7 @@ llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const ValueDecl *VD,
/// EmitDeclare - Emit local variable declaration debug info.
void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
- llvm::Value *Storage, CGBuilderTy &Builder,
- bool IndirectArgument) {
+ llvm::Value *Storage, CGBuilderTy &Builder) {
assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
llvm::DIFile Unit = getOrCreateFile(VD->getLocation());
@@ -1758,17 +1757,19 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
if (!Ty)
return;
- // If an aggregate variable has non trivial destructor or non trivial copy
- // constructor than it is pass indirectly. Let debug info know about this
- // by using reference of the aggregate type as a argument type.
- if (IndirectArgument && VD->getType()->isClassType())
- Ty = DBuilder.CreateReferenceType(Ty);
-
- // If Storage is an aggregate returned as 'sret' then let debugger know
- // about this.
- if (llvm::Argument *Arg = dyn_cast<llvm::Argument>(Storage))
+ if (llvm::Argument *Arg = dyn_cast<llvm::Argument>(Storage)) {
+ // If Storage is an aggregate returned as 'sret' then let debugger know
+ // about this.
if (Arg->hasStructRetAttr())
Ty = DBuilder.CreateReferenceType(Ty);
+ else if (CXXRecordDecl *Record = VD->getType()->getAsCXXRecordDecl()) {
+ // If an aggregate variable has non trivial destructor or non trivial copy
+ // constructor than it is pass indirectly. Let debug info know about this
+ // by using reference of the aggregate type as a argument type.
+ if (!Record->hasTrivialCopyConstructor() || !Record->hasTrivialDestructor())
+ Ty = DBuilder.CreateReferenceType(Ty);
+ }
+ }
// Get location information.
unsigned Line = getLineNumber(VD->getLocation());
@@ -1930,10 +1931,8 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
/// EmitDeclareOfArgVariable - Emit call to llvm.dbg.declare for an argument
/// variable declaration.
void CGDebugInfo::EmitDeclareOfArgVariable(const VarDecl *VD, llvm::Value *AI,
- CGBuilderTy &Builder,
- bool IndirectArgument) {
- EmitDeclare(VD, llvm::dwarf::DW_TAG_arg_variable, AI, Builder,
- IndirectArgument);
+ CGBuilderTy &Builder) {
+ EmitDeclare(VD, llvm::dwarf::DW_TAG_arg_variable, AI, Builder);
}