diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-03-29 10:39:17 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-03-29 10:39:17 +0000 |
commit | 3096d209bf6b177d15d5509717ca77f94433c389 (patch) | |
tree | 53d828d141b5895e4cebc8651245832f139a57f0 /clang/lib/Sema | |
parent | ffce24570048860fbc6d47ce0ed2247149437625 (diff) | |
download | bcm5719-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/Sema')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 4 |
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"; |