diff options
author | Tyler Nowicki <tnowicki@apple.com> | 2014-06-13 17:57:25 +0000 |
---|---|---|
committer | Tyler Nowicki <tnowicki@apple.com> | 2014-06-13 17:57:25 +0000 |
commit | fe84cfe70015f94322e3517b4bf3e5cbf29811d4 (patch) | |
tree | 09148b345995c1afd09db49217b82d944351b161 /include | |
parent | ee5a39f2cf1dce6408eea925fab7312572b421f5 (diff) | |
download | clang-fe84cfe70015f94322e3517b4bf3e5cbf29811d4.tar.gz clang-fe84cfe70015f94322e3517b4bf3e5cbf29811d4.tar.bz2 clang-fe84cfe70015f94322e3517b4bf3e5cbf29811d4.tar.xz |
Adds a Pragma spelling for attributes to tablegen and makes use of it for loop
hint attributes. Includes tests for pragma printing and for attribute order
which is incorrectly reversed by ParsedAttributes.
Reviewed by Aaron Ballman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210925 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/Attr.td | 12 | ||||
-rw-r--r-- | include/clang/Basic/Attributes.h | 4 | ||||
-rw-r--r-- | include/clang/Sema/AttributeList.h | 4 |
3 files changed, 12 insertions, 8 deletions
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 96704160c0..ab83db206e 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -190,6 +190,9 @@ class CXX11<string namespace, string name> : Spelling<name, "CXX11"> { string Namespace = namespace; } class Keyword<string name> : Spelling<name, "Keyword">; +class Pragma<string namespace, string name> : Spelling<name, "Pragma"> { + string Namespace = namespace; +} // The GCC spelling implies GNU<name, "GNU"> and CXX11<"gnu", name> and also // sets KnownToGCC to 1. This spelling should be used for any GCC-compatible @@ -1769,9 +1772,7 @@ def LoopHint : Attr { /// unroll: unroll loop if 'value != 0'. /// unroll_count: unrolls loop 'value' times. - /// FIXME: Add Pragma spelling to tablegen and - /// use it here. - let Spellings = [Keyword<"loop">]; + let Spellings = [Pragma<"clang", "loop">]; /// State of the loop optimization specified by the spelling. let Args = [EnumArgument<"Option", "OptionType", @@ -1800,9 +1801,8 @@ def LoopHint : Attr { return "disable"; } - // FIXME: Modify pretty printer to print this pragma. - void print(raw_ostream &OS, const PrintingPolicy &Policy) const { - OS << "#pragma clang loop " << getOptionName(option) << "("; + void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const { + OS << getOptionName(option) << "("; if (option == VectorizeWidth || option == InterleaveCount || option == UnrollCount) OS << value; diff --git a/include/clang/Basic/Attributes.h b/include/clang/Basic/Attributes.h index 4a7e4629d0..5783b3bff5 100644 --- a/include/clang/Basic/Attributes.h +++ b/include/clang/Basic/Attributes.h @@ -25,7 +25,9 @@ enum class AttrSyntax { /// Is the identifier known as a __declspec-style attribute? Declspec, // Is the identifier known as a C++-style attribute? - CXX + CXX, + // Is the identifier known as a pragma attribute? + Pragma }; /// \brief Return true if we recognize and implement the attribute specified by diff --git a/include/clang/Sema/AttributeList.h b/include/clang/Sema/AttributeList.h index 6872ccc98d..24e4cd41f9 100644 --- a/include/clang/Sema/AttributeList.h +++ b/include/clang/Sema/AttributeList.h @@ -80,7 +80,9 @@ public: /// __declspec(...) AS_Declspec, /// __ptr16, alignas(...), etc. - AS_Keyword + AS_Keyword, + /// #pragma ... + AS_Pragma }; private: |