r209157 - Allow dllimport on function definitions when they're template instantiations
Hans Wennborg
hans at hanshq.net
Mon May 19 13:14:14 PDT 2014
Author: hans
Date: Mon May 19 15:14:13 2014
New Revision: 209157
URL: http://llvm.org/viewvc/llvm-project?rev=209157&view=rev
Log:
Allow dllimport on function definitions when they're template instantiations
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/CodeGenCXX/dllimport.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=209157&r1=209156&r2=209157&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon May 19 15:14:13 2014
@@ -9766,7 +9766,8 @@ Decl *Sema::ActOnStartOfFunctionDef(Scop
ResolveExceptionSpec(D->getLocation(), FPT);
// dllimport cannot be applied to non-inline function definitions.
- if (FD->hasAttr<DLLImportAttr>() && !FD->isInlined()) {
+ if (FD->hasAttr<DLLImportAttr>() && !FD->isInlined() &&
+ !FD->isTemplateInstantiation()) {
assert(!FD->hasAttr<DLLExportAttr>());
Diag(FD->getLocation(), diag::err_attribute_dllimport_function_definition);
FD->setInvalidDecl();
Modified: cfe/trunk/test/CodeGenCXX/dllimport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllimport.cpp?rev=209157&r1=209156&r2=209157&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/dllimport.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dllimport.cpp Mon May 19 15:14:13 2014
@@ -8,7 +8,7 @@ void DLLIMPORT a();
inline void DLLIMPORT b() {}
// CHECK-DAG: define available_externally dllimport void @"\01?b@@YAXXZ"()
-template <typename T> inline void c() {} // FIXME: MSVC accepts this without 'inline' too.
+template <typename T> void c() {}
template void DLLIMPORT c<int>();
// CHECK-DAG: define available_externally dllimport void @"\01??$c at H@@YAXXZ"()
More information about the cfe-commits
mailing list