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.

llvm-svn: 318714

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

index 769b47a..cf1579e 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 5a3473a..7bbf0d1 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 af22fa8..0f108b5 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);
@@ -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 2fab344..4a1f52e 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) {