aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-03-06 16:43:04 +0000
committerAnders Carlsson <andersca@mac.com>2011-03-06 16:43:04 +0000
commitebc327977645f03e12aaeba82f7f53299e47ad3a (patch)
tree1da7d0df69202586db7998d8b8228b4aa48d7ff7
parenta868c3799b739781db325c1bd2c6afd182bc9bd6 (diff)
Correctly unwrap 'auto' types. Fixes PR9414.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127121 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp3
-rw-r--r--test/CodeGenCXX/debug-info-cxx0x.cpp8
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index bccf6e77cd..b23b392222 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1374,6 +1374,9 @@ static QualType UnwrapTypeForDebugInfo(QualType T) {
case Type::SubstTemplateTypeParm:
T = cast<SubstTemplateTypeParmType>(T)->getReplacementType();
break;
+ case Type::Auto:
+ T = cast<AutoType>(T)->getDeducedType();
+ break;
}
assert(T != LastT && "Type unwrapping failed to unwrap!");
diff --git a/test/CodeGenCXX/debug-info-cxx0x.cpp b/test/CodeGenCXX/debug-info-cxx0x.cpp
new file mode 100644
index 0000000000..5753b05d72
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-cxx0x.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm-only -std=c++0x -g %s
+
+namespace PR9414 {
+ int f() {
+ auto x = 0;
+ return x;
+ }
+}