]> granicus.if.org Git - llvm/commitdiff
llvm-rc/ResourceScriptTokenList.h: Turns this into a .def file to imply that it's...
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 21 Nov 2017 00:23:19 +0000 (00:23 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 21 Nov 2017 00:23:19 +0000 (00:23 +0000)
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

tools/llvm-rc/ResourceScriptParser.cpp
tools/llvm-rc/ResourceScriptToken.cpp
tools/llvm-rc/ResourceScriptToken.h
tools/llvm-rc/ResourceScriptTokenList.def [moved from tools/llvm-rc/ResourceScriptTokenList.h with 98% similarity]
tools/llvm-rc/llvm-rc.cpp

index 769b47a20bd149b882e642ab174aac5b3a23e2d9..cf1579ee2a110feaebb1a7df0ba95761e22a23e1 100644 (file)
@@ -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.");
index 5a3473a4b083ca3b5f69652e2b2455fb00de468c..7bbf0d16f044dc2243b3b7b754001b2c29a9762d 100644 (file)
@@ -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;
index af22fa8d3eb0aece238fbd5a2a48cf89fb398105..0f108b50ed107572f5ead4d2b0ce7ec904003614 100644 (file)
@@ -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);
similarity index 98%
rename from tools/llvm-rc/ResourceScriptTokenList.h
rename to tools/llvm-rc/ResourceScriptTokenList.def
index 2a7e15f93321efdd7a8f8cbe7646cdd584ac5aa9..085b728ff5208c9f415c4844da6dc7841c859b27 100644 (file)
@@ -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
index 2fab3440e1cd4a9945b1712c4eadd87421125276..4a1f52e66dee0de9931500574347a548c5b5a5ed 100644 (file)
@@ -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) {