[cfe-commits] r89737 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGenCXX/member-templates.cpp

Anders Carlsson andersca at mac.com
Mon Nov 23 21:16:24 PST 2009


Author: andersca
Date: Mon Nov 23 23:16:24 2009
New Revision: 89737

URL: http://llvm.org/viewvc/llvm-project?rev=89737&view=rev
Log:
Ignore constructor member templates in CodeGenModule::EmitTopLevelDecl.

Added:
    cfe/trunk/test/CodeGenCXX/member-templates.cpp
Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=89737&r1=89736&r2=89737&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Nov 23 23:16:24 2009
@@ -1734,6 +1734,10 @@
   case Decl::NamespaceAlias:
     break;
   case Decl::CXXConstructor:
+    // Skip function templates
+    if (cast<FunctionDecl>(D)->getDescribedFunctionTemplate())
+      return;
+      
     EmitCXXConstructors(cast<CXXConstructorDecl>(D));
     break;
   case Decl::CXXDestructor:

Added: cfe/trunk/test/CodeGenCXX/member-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-templates.cpp?rev=89737&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenCXX/member-templates.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/member-templates.cpp Mon Nov 23 23:16:24 2009
@@ -0,0 +1,9 @@
+// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+// CHECK: ; ModuleID
+struct A {
+  template<typename T>
+  A(T);
+};
+
+template<typename T> A::A(T) {}





More information about the cfe-commits mailing list