diff options
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 5c868e94e3..af216d26e5 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -3844,13 +3844,6 @@ DLLImportAttr *Sema::mergeDLLImportAttr(Decl *D, SourceRange Range, return ::new (Context) DLLImportAttr(Range, Context, AttrSpellingListIndex); } -static void handleDLLImportAttr(Sema &S, Decl *D, const AttributeList &Attr) { - unsigned Index = Attr.getAttributeSpellingListIndex(); - DLLImportAttr *NewAttr = S.mergeDLLImportAttr(D, Attr.getRange(), Index); - if (NewAttr) - D->addAttr(NewAttr); -} - DLLExportAttr *Sema::mergeDLLExportAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex) { if (DLLImportAttr *Import = D->getAttr<DLLImportAttr>()) { @@ -3864,9 +3857,11 @@ DLLExportAttr *Sema::mergeDLLExportAttr(Decl *D, SourceRange Range, return ::new (Context) DLLExportAttr(Range, Context, AttrSpellingListIndex); } -static void handleDLLExportAttr(Sema &S, Decl *D, const AttributeList &Attr) { - unsigned Index = Attr.getAttributeSpellingListIndex(); - DLLExportAttr *NewAttr = S.mergeDLLExportAttr(D, Attr.getRange(), Index); +static void handleDLLAttr(Sema &S, Decl *D, const AttributeList &A) { + unsigned Index = A.getAttributeSpellingListIndex(); + Attr *NewAttr = A.getKind() == AttributeList::AT_DLLExport + ? (Attr *)S.mergeDLLExportAttr(D, A.getRange(), Index) + : (Attr *)S.mergeDLLImportAttr(D, A.getRange(), Index); if (NewAttr) D->addAttr(NewAttr); } @@ -4070,10 +4065,8 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, handleX86ForceAlignArgPointerAttr(S, D, Attr); break; case AttributeList::AT_DLLExport: - handleDLLExportAttr(S, D, Attr); - break; case AttributeList::AT_DLLImport: - handleDLLImportAttr(S, D, Attr); + handleDLLAttr(S, D, Attr); break; case AttributeList::AT_Mips16: handleSimpleAttribute<Mips16Attr>(S, D, Attr); |