r241526 - Update target attribute support for post-commit feedback.

Aaron Ballman aaron at aaronballman.com
Mon Jul 6 16:57:11 PDT 2015


On Mon, Jul 6, 2015 at 7:52 PM, Eric Christopher <echristo at gmail.com> wrote:
> Author: echristo
> Date: Mon Jul  6 18:52:01 2015
> New Revision: 241526
>
> URL: http://llvm.org/viewvc/llvm-project?rev=241526&view=rev
> Log:
> Update target attribute support for post-commit feedback.
>
> Use const auto rather than duplicating the type name and fix the
> error message when the attribute is applied to an incorrect entity.

Thank you for this (one comment below)!

>
> Modified:
>     cfe/trunk/include/clang/Basic/Attr.td
>     cfe/trunk/lib/CodeGen/CGCall.cpp
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=241526&r1=241525&r2=241526&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Mon Jul  6 18:52:01 2015
> @@ -1277,7 +1277,7 @@ def Target : InheritableAttr {
>    let Spellings = [GCC<"target">];
>    let Args = [StringArgument<"features">];
>    let Subjects =
> -      SubjectList<[Function], ErrorDiag, "ExpectedFunctionMethodOrClass">;
> +      SubjectList<[Function], ErrorDiag, "ExpectedFunction">;

You can actually elide the ExpectedFunction part as well. The tablegen
smarts handle the easy cases for you.

~Aaron

>    let Documentation = [Undocumented];
>  }
>
>
> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=241526&r1=241525&r2=241526&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Jul  6 18:52:01 2015
> @@ -1506,7 +1506,7 @@ void CodeGenModule::ConstructAttributeLi
>
>      const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(TargetDecl);
>      if (FD) {
> -      if (const TargetAttr *TD = FD->getAttr<TargetAttr>()) {
> +      if (const auto *TD = FD->getAttr<TargetAttr>()) {
>          StringRef FeaturesStr = TD->getFeatures();
>          SmallVector<StringRef, 1> AttrFeatures;
>          FeaturesStr.split(AttrFeatures, ",");
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list