]> granicus.if.org Git - clang/commitdiff
Do not drop type qualifiers in -flimit-debug-info mode.
authorDevang Patel <dpatel@apple.com>
Mon, 24 Oct 2011 23:15:17 +0000 (23:15 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 24 Oct 2011 23:15:17 +0000 (23:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142873 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenCXX/debug-info-method2.cpp [new file with mode: 0644]

index 2e1d12d8ce8b4681c82330d290c8f257137205f3..4448153591fba250ddff0885995bcd48ab8a237a 100644 (file)
@@ -486,7 +486,13 @@ llvm::DIType CGDebugInfo::CreatePointeeType(QualType PointeeTy,
                                             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());
diff --git a/test/CodeGenCXX/debug-info-method2.cpp b/test/CodeGenCXX/debug-info-method2.cpp
new file mode 100644 (file)
index 0000000..0d0e31f
--- /dev/null
@@ -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;
+}