diff options
author | David Blaikie <dblaikie@gmail.com> | 2017-11-21 00:23:19 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2017-11-21 00:23:19 +0000 |
commit | bb5acf9b6f7315e96108b323bca0c0a491297612 (patch) | |
tree | c8917b0d8e624e2a7fd4e5927317828289e95a12 /tools/llvm-rc | |
parent | 968314e023b27e2fa477d93870688e78f43ea0d2 (diff) |
llvm-rc/ResourceScriptTokenList.h: Turns this into a .def file to imply that it's non-modular
Also undef the macros at the end of the file to make it easier to use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-rc')
-rw-r--r-- | tools/llvm-rc/ResourceScriptParser.cpp | 4 | ||||
-rw-r--r-- | tools/llvm-rc/ResourceScriptToken.cpp | 8 | ||||
-rw-r--r-- | tools/llvm-rc/ResourceScriptToken.h | 6 | ||||
-rw-r--r-- | tools/llvm-rc/ResourceScriptTokenList.def (renamed from tools/llvm-rc/ResourceScriptTokenList.h) | 3 | ||||
-rw-r--r-- | tools/llvm-rc/llvm-rc.cpp | 4 |
5 files changed, 9 insertions, 16 deletions
diff --git a/tools/llvm-rc/ResourceScriptParser.cpp b/tools/llvm-rc/ResourceScriptParser.cpp index 769b47a20bd..cf1579ee2a1 100644 --- a/tools/llvm-rc/ResourceScriptParser.cpp +++ b/tools/llvm-rc/ResourceScriptParser.cpp @@ -245,9 +245,7 @@ Error RCParser::consumeType(Kind TokenKind) { #define SHORT_TOKEN(TokenName, TokenCh) \ case Kind::TokenName: \ return getExpectedError(#TokenCh); -#include "ResourceScriptTokenList.h" -#undef SHORT_TOKEN -#undef TOKEN +#include "ResourceScriptTokenList.def" } llvm_unreachable("All case options exhausted."); diff --git a/tools/llvm-rc/ResourceScriptToken.cpp b/tools/llvm-rc/ResourceScriptToken.cpp index 5a3473a4b08..7bbf0d16f04 100644 --- a/tools/llvm-rc/ResourceScriptToken.cpp +++ b/tools/llvm-rc/ResourceScriptToken.cpp @@ -212,9 +212,7 @@ Error Tokenizer::consumeToken(const Kind TokenKind) { // One-character token consumption. #define TOKEN(Name) #define SHORT_TOKEN(Name, Ch) case Kind::Name: -#include "ResourceScriptTokenList.h" -#undef TOKEN -#undef SHORT_TOKEN +#include "ResourceScriptTokenList.def" advance(); return Error::success(); @@ -340,9 +338,7 @@ Kind Tokenizer::classifyCurrentToken() const { #define SHORT_TOKEN(Name, Ch) \ case Ch: \ return Kind::Name; -#include "ResourceScriptTokenList.h" -#undef TOKEN -#undef SHORT_TOKEN +#include "ResourceScriptTokenList.def" default: return Kind::Invalid; diff --git a/tools/llvm-rc/ResourceScriptToken.h b/tools/llvm-rc/ResourceScriptToken.h index af22fa8d3eb..0f108b50ed1 100644 --- a/tools/llvm-rc/ResourceScriptToken.h +++ b/tools/llvm-rc/ResourceScriptToken.h @@ -9,7 +9,7 @@ // // This declares the .rc script tokens and defines an interface for tokenizing // the input data. The list of available tokens is located at -// ResourceScriptTokenList.h. +// ResourceScriptTokenList.def. // // Note that the tokenizer does not support comments or preprocessor // directives. The preprocessor should do its work on the .rc file before @@ -47,9 +47,7 @@ public: enum class Kind { #define TOKEN(Name) Name, #define SHORT_TOKEN(Name, Ch) Name, -#include "ResourceScriptTokenList.h" -#undef TOKEN -#undef SHORT_TOKEN +#include "ResourceScriptTokenList.def" }; RCToken(RCToken::Kind RCTokenKind, StringRef Value); diff --git a/tools/llvm-rc/ResourceScriptTokenList.h b/tools/llvm-rc/ResourceScriptTokenList.def index 2a7e15f9332..085b728ff52 100644 --- a/tools/llvm-rc/ResourceScriptTokenList.h +++ b/tools/llvm-rc/ResourceScriptTokenList.def @@ -35,3 +35,6 @@ SHORT_TOKEN(Amp, '&') // Bitwise-AND operator. SHORT_TOKEN(Tilde, '~') // Bitwise-NOT operator. SHORT_TOKEN(LeftParen, '(') // Left parenthesis in the script expressions. SHORT_TOKEN(RightParen, ')') // Right parenthesis. + +#undef TOKEN +#undef SHORT_TOKEN diff --git a/tools/llvm-rc/llvm-rc.cpp b/tools/llvm-rc/llvm-rc.cpp index 2fab3440e1c..4a1f52e66de 100644 --- a/tools/llvm-rc/llvm-rc.cpp +++ b/tools/llvm-rc/llvm-rc.cpp @@ -124,9 +124,7 @@ int main(int argc_, const char *argv_[]) { const Twine TokenNames[] = { #define TOKEN(Name) #Name, #define SHORT_TOKEN(Name, Ch) #Name, -#include "ResourceScriptTokenList.h" -#undef TOKEN -#undef SHORT_TOKEN +#include "ResourceScriptTokenList.def" }; for (const RCToken &Token : Tokens) { |