r182673 - PR16091: Error when attempting to emit debug info for undeduced auto return types

David Blaikie dblaikie at gmail.com
Fri May 24 14:24:35 PDT 2013


Author: dblaikie
Date: Fri May 24 16:24:35 2013
New Revision: 182673

URL: http://llvm.org/viewvc/llvm-project?rev=182673&view=rev
Log:
PR16091: Error when attempting to emit debug info for undeduced auto return types

Perhaps we should just suppress this, rather than erroring, but since we
have the infrastructure for it I figured I'd use it - if this is
determined to be not the right thing we should probably remove that
infrastructure entirely. I guess it's lying around from the early days
of implementing debug info support.

Added:
    cfe/trunk/test/CodeGenCXX/debug-info-cxx1y.cpp
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=182673&r1=182672&r2=182673&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri May 24 16:24:35 2013
@@ -1827,7 +1827,10 @@ static QualType UnwrapTypeForDebugInfo(Q
       T = cast<SubstTemplateTypeParmType>(T)->getReplacementType();
       break;
     case Type::Auto:
-      T = cast<AutoType>(T)->getDeducedType();
+      QualType DT = cast<AutoType>(T)->getDeducedType();
+      if (DT.isNull())
+        return T;
+      T = DT;
       break;
     }
 
@@ -2044,8 +2047,10 @@ llvm::DIType CGDebugInfo::CreateTypeNode
   case Type::TypeOf:
   case Type::Decltype:
   case Type::UnaryTransform:
-  case Type::Auto:
     llvm_unreachable("type should have been unwrapped!");
+  case Type::Auto:
+    Diag = "auto";
+    break;
   }
 
   assert(Diag && "Fall through without a diagnostic?");

Added: cfe/trunk/test/CodeGenCXX/debug-info-cxx1y.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-cxx1y.cpp?rev=182673&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-cxx1y.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-cxx1y.cpp Fri May 24 16:24:35 2013
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -emit-llvm-only -std=c++1y -g %s 2>&1 | FileCheck %s
+
+struct foo {
+  auto func(); // CHECK: error: debug information for auto is not yet supported
+};
+
+foo f;





More information about the cfe-commits mailing list