diff options
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 8 | ||||
-rw-r--r-- | test/CodeGenCXX/debug-info-method2.cpp | 20 |
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 2e1d12d8ce..4448153591 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/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/test/CodeGenCXX/debug-info-method2.cpp b/test/CodeGenCXX/debug-info-method2.cpp new file mode 100644 index 0000000000..0d0e31fb7b --- /dev/null +++ b/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; +} |