summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFrancois Pichet <pichet2000@gmail.com>2011-03-29 10:39:17 +0000
committerFrancois Pichet <pichet2000@gmail.com>2011-03-29 10:39:17 +0000
commit3096d209bf6b177d15d5509717ca77f94433c389 (patch)
tree53d828d141b5895e4cebc8651245832f139a57f0 /clang/lib
parentffce24570048860fbc6d47ce0ed2247149437625 (diff)
downloadbcm5719-llvm-3096d209bf6b177d15d5509717ca77f94433c389.tar.gz
bcm5719-llvm-3096d209bf6b177d15d5509717ca77f94433c389.zip
Accept __declspec(dllimport) for function defined at class scope in Microsoft mode.
This fixes a bunch of errors when compiling MSVC header files with the -DDLL flag. llvm-svn: 128457
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 7a1492a53b5..e52082bbbfc 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5701,7 +5701,9 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) {
DLLImportAttr *DA = FD->getAttr<DLLImportAttr>();
if (DA && (!FD->getAttr<DLLExportAttr>())) {
// dllimport attribute cannot be directly applied to definition.
- if (!DA->isInherited()) {
+ // Microsoft accepts dllimport for functions defined within class scope.
+ if (!DA->isInherited() &&
+ !(LangOpts.Microsoft && FD->getLexicalDeclContext()->isRecord())) {
Diag(FD->getLocation(),
diag::err_attribute_can_be_applied_only_to_symbol_declaration)
<< "dllimport";
OpenPOWER on IntegriCloud