diff options
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 2f434cedfe6..3c19e9632f6 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -9764,20 +9764,12 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) { if (const FunctionProtoType *FPT = FD->getType()->getAs<FunctionProtoType>()) ResolveExceptionSpec(D->getLocation(), FPT); - // Checking attributes of current function definition - // dllimport attribute. - DLLImportAttr *DA = FD->getAttr<DLLImportAttr>(); - if (DA && (!FD->hasAttr<DLLExportAttr>())) { - // dllimport attribute cannot be directly applied to definition. - // Microsoft accepts dllimport for functions defined within class scope. - if (!DA->isInherited() && - !(LangOpts.MicrosoftExt && FD->getLexicalDeclContext()->isRecord())) { - Diag(FD->getLocation(), - diag::err_attribute_can_be_applied_only_to_symbol_declaration) - << DA; - FD->setInvalidDecl(); - return D; - } + // dllimport cannot be applied to non-inline function definitions. + if (FD->hasAttr<DLLImportAttr>() && !FD->isInlined()) { + assert(!FD->hasAttr<DLLExportAttr>()); + Diag(FD->getLocation(), diag::err_attribute_dllimport_function_definition); + FD->setInvalidDecl(); + return D; } // We want to attach documentation to original Decl (which might be // a function template). |