Merge handleDLLImportAttr and handleDLLExportAttr into one function.

llvm-svn: 211647
This commit is contained in:
Hans Wennborg 2014-06-24 23:57:05 +00:00
parent c607d8e7be
commit e82f19c14e
1 changed files with 6 additions and 13 deletions

View File

@ -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);