[cfe-commits] r142873 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/debug-info-method2.cpp
Devang Patel
dpatel at apple.com
Mon Oct 24 16:15:17 PDT 2011
Author: dpatel
Date: Mon Oct 24 18:15:17 2011
New Revision: 142873
URL: http://llvm.org/viewvc/llvm-project?rev=142873&view=rev
Log:
Do not drop type qualifiers in -flimit-debug-info mode.
Added:
cfe/trunk/test/CodeGenCXX/debug-info-method2.cpp
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=142873&r1=142872&r2=142873&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Oct 24 18:15:17 2011
@@ -486,7 +486,13 @@
llvm::DIFile Unit) {
if (!CGM.getCodeGenOpts().LimitDebugInfo)
return getOrCreateType(PointeeTy, Unit);
-
+
+ // Limit debug info for the pointee type.
+
+ // Handle qualifiers.
+ if (PointeeTy.hasLocalQualifiers())
+ return CreateQualifiedType(PointeeTy, Unit);
+
if (const RecordType *RTy = dyn_cast<RecordType>(PointeeTy)) {
RecordDecl *RD = RTy->getDecl();
llvm::DIFile DefUnit = getOrCreateFile(RD->getLocation());
Added: cfe/trunk/test/CodeGenCXX/debug-info-method2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-method2.cpp?rev=142873&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-method2.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-method2.cpp Mon Oct 24 18:15:17 2011
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -flimit-debug-info -x c++ -g -S -emit-llvm < %s | FileCheck %s
+// rdar://10336845
+// Preserve type qualifiers in -flimit-debug-info mode.
+
+// 720934 = DW_TAG_const_type | LLVMDebugVersion
+// CHECK: metadata !{i32 720934
+class A {
+public:
+ int bar(int arg) const;
+};
+
+int A::bar(int arg) const{
+ return arg+2;
+}
+
+int main() {
+ A a;
+ int i = a.bar(2);
+ return i;
+}
More information about the cfe-commits
mailing list