r211647 - Merge handleDLLImportAttr and handleDLLExportAttr into one function.
Hans Wennborg
hans at hanshq.net
Tue Jun 24 16:57:05 PDT 2014
Author: hans
Date: Tue Jun 24 18:57:05 2014
New Revision: 211647
URL: http://llvm.org/viewvc/llvm-project?rev=211647&view=rev
Log:
Merge handleDLLImportAttr and handleDLLExportAttr into one function.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=211647&r1=211646&r2=211647&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Jun 24 18:57:05 2014
@@ -3844,13 +3844,6 @@ DLLImportAttr *Sema::mergeDLLImportAttr(
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(
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
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);
More information about the cfe-commits
mailing list