summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-10-24 23:15:17 +0000
committerDevang Patel <dpatel@apple.com>2011-10-24 23:15:17 +0000
commit242ce91ecc84c84879b7db8ae857cc07377c3200 (patch)
tree86b190b3d662f327f37cedf7d2c142d08c31dc0b
parent733237db23ecf0ec3487caf960b88bdc49b76bc9 (diff)
downloadbcm5719-llvm-242ce91ecc84c84879b7db8ae857cc07377c3200.tar.gz
bcm5719-llvm-242ce91ecc84c84879b7db8ae857cc07377c3200.zip
Do not drop type qualifiers in -flimit-debug-info mode.
llvm-svn: 142873
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp8
-rw-r--r--clang/test/CodeGenCXX/debug-info-method2.cpp20
2 files changed, 27 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 2e1d12d8ce8..4448153591f 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -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/clang/test/CodeGenCXX/debug-info-method2.cpp b/clang/test/CodeGenCXX/debug-info-method2.cpp
new file mode 100644
index 00000000000..0d0e31fb7b5
--- /dev/null
+++ b/clang/test/CodeGenCXX/debug-info-method2.cpp
@@ -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;
+}
OpenPOWER on IntegriCloud