]> granicus.if.org Git - clang/commitdiff
Correctly unwrap 'auto' types. Fixes PR9414.
authorAnders Carlsson <andersca@mac.com>
Sun, 6 Mar 2011 16:43:04 +0000 (16:43 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 6 Mar 2011 16:43:04 +0000 (16:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127121 91177308-0d34-0410-b5e6-96231b3b80d8

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

index bccf6e77cd919e27f490d68bde41a48b1cd799f6..b23b3922222104acd48c9f4152adcbc02dd8f06a 100644 (file)
@@ -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 (file)
index 0000000..5753b05
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm-only -std=c++0x -g %s
+
+namespace PR9414 {
+  int f() {
+    auto x = 0;
+    return x;
+  }
+}