From: Aaron Ballman Date: Wed, 8 Jan 2014 13:23:01 +0000 (+0000) Subject: Treating the RegParmAttr as a TypeAttr because that is what it is. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03748d2395506ed49c542ba97537e7e0d1899e7a;p=clang Treating the RegParmAttr as a TypeAttr because that is what it is. Patch reviewed by Rafael Espindola. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198765 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index cd1cbb2218..2ef3fb3853 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -779,9 +779,10 @@ def Pure : InheritableAttr { let Spellings = [GNU<"pure">, CXX11<"gnu", "pure">]; } -def Regparm : InheritableAttr { +def Regparm : TypeAttr { let Spellings = [GNU<"regparm">, CXX11<"gnu", "regparm">]; let Args = [UnsignedArgument<"NumParams">]; + let ASTNode = 0; } def ReqdWorkGroupSize : InheritableAttr { diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 6b23dd6691..23649c6694 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -3228,24 +3228,6 @@ bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC, return false; } -static void handleRegparmAttr(Sema &S, Decl *D, const AttributeList &Attr) { - if (hasDeclarator(D)) return; - - unsigned numParams; - if (S.CheckRegparmAttr(Attr, numParams)) - return; - - if (!isa(D)) { - S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) - << Attr.getName() << ExpectedFunctionOrMethod; - return; - } - - D->addAttr(::new (S.Context) - RegparmAttr(Attr.getRange(), S.Context, numParams, - Attr.getAttributeSpellingListIndex())); -} - /// Checks a regparm attribute, returning true if it is ill-formed and /// otherwise setting numParams to the appropriate value. bool Sema::CheckRegparmAttr(const AttributeList &Attr, unsigned &numParams) { @@ -3799,6 +3781,7 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, case AttributeList::AT_Ptr64: case AttributeList::AT_SPtr: case AttributeList::AT_UPtr: + case AttributeList::AT_Regparm: // Ignore these, these are type attributes, handled by // ProcessTypeAttributes. break; @@ -3963,7 +3946,6 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, case AttributeList::AT_NoDebug: handleNoDebugAttr (S, D, Attr); break; case AttributeList::AT_NoInline: handleSimpleAttribute(S, D, Attr); break; - case AttributeList::AT_Regparm: handleRegparmAttr (S, D, Attr); break; case AttributeList::IgnoredAttribute: // Just ignore break;