r182182 - Handle local enum types too.

Rafael Espindola rafael.espindola at gmail.com
Fri May 17 17:33:29 PDT 2013


Author: rafael
Date: Fri May 17 19:33:28 2013
New Revision: 182182

URL: http://llvm.org/viewvc/llvm-project?rev=182182&view=rev
Log:
Handle local enum types too.

Thanks to John McCall for pointing this out.

Modified:
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/test/CodeGenCXX/linkage.cpp

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=182182&r1=182181&r2=182182&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri May 17 19:33:28 2013
@@ -298,11 +298,8 @@ static LinkageInfo getLIForTemplateTypeA
   if (!TT)
     return LI;
 
-  const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(TT->getDecl());
-  if (!RD)
-    return LI;
-
-  const FunctionDecl *FD = getOutermostFunctionContext(RD);
+  const Decl *D = TT->getDecl();
+  const FunctionDecl *FD = getOutermostFunctionContext(D);
   if (!FD)
     return LI;
 

Modified: cfe/trunk/test/CodeGenCXX/linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/linkage.cpp?rev=182182&r1=182181&r2=182182&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/linkage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/linkage.cpp Fri May 17 19:33:28 2013
@@ -92,3 +92,14 @@ namespace test7 {
 
   void *h() { return g(); }
 }
+
+namespace test8 {
+  // CHECK-DAG: define linkonce_odr void @_ZN5test81fIZNS_1gEvE1SEEvT_(
+  template <typename T> void f(T) {}
+  inline void *g() {
+    enum S {
+    };
+    return reinterpret_cast<void *>(f<S>);
+  }
+  void *h() { return g(); }
+}





More information about the cfe-commits mailing list