From: Anders Carlsson Date: Sun, 6 Mar 2011 16:43:04 +0000 (+0000) Subject: Correctly unwrap 'auto' types. Fixes PR9414. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ebc327977645f03e12aaeba82f7f53299e47ad3a;p=clang Correctly unwrap 'auto' types. Fixes PR9414. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127121 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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(T)->getReplacementType(); break; + case Type::Auto: + T = cast(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; + } +}