Sema: Simplify checkAttributesAfterMerging

Use getDLLAttr to factor out some common dllimport/dllexport code.

llvm-svn: 219048
This commit is contained in:
David Majnemer 2014-10-04 06:16:45 +00:00
parent 808ec85ad0
commit 7656f41809
1 changed files with 1 additions and 8 deletions

View File

@ -5103,14 +5103,7 @@ static void checkAttributesAfterMerging(Sema &S, NamedDecl &ND) {
}
// dll attributes require external linkage.
if (const DLLImportAttr *Attr = ND.getAttr<DLLImportAttr>()) {
if (!ND.isExternallyVisible()) {
S.Diag(ND.getLocation(), diag::err_attribute_dll_not_extern)
<< &ND << Attr;
ND.setInvalidDecl();
}
}
if (const DLLExportAttr *Attr = ND.getAttr<DLLExportAttr>()) {
if (const InheritableAttr *Attr = getDLLAttr(&ND)) {
if (!ND.isExternallyVisible()) {
S.Diag(ND.getLocation(), diag::err_attribute_dll_not_extern)
<< &ND << Attr;