[llvm] r318714 - llvm-rc/ResourceScriptTokenList.h: Turns this into a .def file to imply that it's non-modular
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 20 16:23:20 PST 2017
Author: dblaikie
Date: Mon Nov 20 16:23:19 2017
New Revision: 318714
URL: http://llvm.org/viewvc/llvm-project?rev=318714&view=rev
Log:
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.
Added:
llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.def
- copied, changed from r318713, llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.h
Removed:
llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.h
Modified:
llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp
llvm/trunk/tools/llvm-rc/ResourceScriptToken.cpp
llvm/trunk/tools/llvm-rc/ResourceScriptToken.h
llvm/trunk/tools/llvm-rc/llvm-rc.cpp
Modified: llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp?rev=318714&r1=318713&r2=318714&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp (original)
+++ llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp Mon Nov 20 16:23:19 2017
@@ -245,9 +245,7 @@ Error RCParser::consumeType(Kind TokenKi
#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.");
Modified: llvm/trunk/tools/llvm-rc/ResourceScriptToken.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/ResourceScriptToken.cpp?rev=318714&r1=318713&r2=318714&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rc/ResourceScriptToken.cpp (original)
+++ llvm/trunk/tools/llvm-rc/ResourceScriptToken.cpp Mon Nov 20 16:23:19 2017
@@ -212,9 +212,7 @@ Error Tokenizer::consumeToken(const Kind
// 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() c
#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;
Modified: llvm/trunk/tools/llvm-rc/ResourceScriptToken.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/ResourceScriptToken.h?rev=318714&r1=318713&r2=318714&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rc/ResourceScriptToken.h (original)
+++ llvm/trunk/tools/llvm-rc/ResourceScriptToken.h Mon Nov 20 16:23:19 2017
@@ -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);
Copied: llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.def (from r318713, llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.def?p2=llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.def&p1=llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.h&r1=318713&r2=318714&rev=318714&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.h (original)
+++ llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.def Mon Nov 20 16:23:19 2017
@@ -35,3 +35,6 @@ SHORT_TOKEN(Amp, '&') // Bitwis
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
Removed: llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.h?rev=318713&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.h (original)
+++ llvm/trunk/tools/llvm-rc/ResourceScriptTokenList.h (removed)
@@ -1,37 +0,0 @@
-//===-- ResourceScriptTokenList.h -------------------------------*- C++-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===---------------------------------------------------------------------===//
-//
-// This is a part of llvm-rc tokenizer. It lists all the possible tokens
-// that might occur in a correct .rc script.
-//
-//===---------------------------------------------------------------------===//
-
-
-// Long tokens. They might consist of more than one character.
-TOKEN(Invalid) // Invalid token. Should not occur in a valid script.
-TOKEN(Int) // Integer (decimal, octal or hexadecimal).
-TOKEN(String) // String value.
-TOKEN(Identifier) // Script identifier (resource name or type).
-TOKEN(LineComment) // Beginning of single-line comment.
-TOKEN(StartComment) // Beginning of multi-line comment.
-
-// Short tokens. They usually consist of exactly one character.
-// The definitions are of the form SHORT_TOKEN(TokenName, TokenChar).
-// TokenChar is the one-character token representation occuring in the correct
-// .rc scripts.
-SHORT_TOKEN(BlockBegin, '{') // Start of the script block; can also be BEGIN.
-SHORT_TOKEN(BlockEnd, '}') // End of the block; can also be END.
-SHORT_TOKEN(Comma, ',') // Comma - resource arguments separator.
-SHORT_TOKEN(Plus, '+') // Addition operator.
-SHORT_TOKEN(Minus, '-') // Subtraction operator.
-SHORT_TOKEN(Pipe, '|') // Bitwise-OR operator.
-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.
Modified: llvm/trunk/tools/llvm-rc/llvm-rc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/llvm-rc.cpp?rev=318714&r1=318713&r2=318714&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rc/llvm-rc.cpp (original)
+++ llvm/trunk/tools/llvm-rc/llvm-rc.cpp Mon Nov 20 16:23:19 2017
@@ -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) {
More information about the llvm-commits
mailing list