[cfe-commits] r171605 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/debug-info-method.cpp
David Blaikie
dblaikie at gmail.com
Fri Jan 4 21:58:35 PST 2013
Author: dblaikie
Date: Fri Jan 4 23:58:35 2013
New Revision: 171605
URL: http://llvm.org/viewvc/llvm-project?rev=171605&view=rev
Log:
Emit debug info for unnamed parameters.
LLVM ignores this data for now - patch for that to follow.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-method.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=171605&r1=171604&r2=171605&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Jan 4 23:58:35 2013
@@ -2428,23 +2428,9 @@
Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
return;
}
-
- // Create the descriptor for the variable.
- llvm::DIVariable D =
- DBuilder.createLocalVariable(Tag, llvm::DIDescriptor(Scope),
- Name, Unit, Line, Ty,
- CGM.getLangOpts().Optimize, Flags, ArgNo);
-
- // Insert an llvm.dbg.declare into the current block.
- llvm::Instruction *Call =
- DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock());
- Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
- return;
- }
-
- // If VD is an anonymous union then Storage represents value for
- // all union fields.
- if (const RecordType *RT = dyn_cast<RecordType>(VD->getType())) {
+ } else if (const RecordType *RT = dyn_cast<RecordType>(VD->getType())) {
+ // If VD is an anonymous union then Storage represents value for
+ // all union fields.
const RecordDecl *RD = cast<RecordDecl>(RT->getDecl());
if (RD->isUnion()) {
for (RecordDecl::field_iterator I = RD->field_begin(),
@@ -2471,7 +2457,19 @@
Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
}
}
+ return;
}
+
+ // Create the descriptor for the variable.
+ llvm::DIVariable D =
+ DBuilder.createLocalVariable(Tag, llvm::DIDescriptor(Scope),
+ Name, Unit, Line, Ty,
+ CGM.getLangOpts().Optimize, Flags, ArgNo);
+
+ // Insert an llvm.dbg.declare into the current block.
+ llvm::Instruction *Call =
+ DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock());
+ Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
}
void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *VD,
Modified: cfe/trunk/test/CodeGenCXX/debug-info-method.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-method.cpp?rev=171605&r1=171604&r2=171605&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-method.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-method.cpp Fri Jan 4 23:58:35 2013
@@ -1,7 +1,12 @@
// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
-// CHECK: metadata !"_ZN1A3fooEv", {{.*}}, i32 258
+// CHECK: metadata !"_ZN1A3fooEi", {{.*}}, i32 258
+// CHECK: ""{{.*}}DW_TAG_arg_variable
class A {
protected:
- int foo();
+ void foo(int);
};
+
+void A::foo(int) {
+}
+
A a;
More information about the cfe-commits
mailing list