[clang-tools-extra] [pseudo] gen Main.cpp (PR #74983)
εΎζζ Xu Chiheng via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 31 13:07:27 PST 2023
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74983
>From 164ce88e00c341b2507618f67a8971d55f9aee9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
<chiheng.xu at gmail.com>
Date: Sun, 10 Dec 2023 15:27:25 +0800
Subject: [PATCH 1/2] 1
---
clang-tools-extra/pseudo/gen/Main.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/clang-tools-extra/pseudo/gen/Main.cpp b/clang-tools-extra/pseudo/gen/Main.cpp
index 25cb26563837a6..c9367ca16ed85e 100644
--- a/clang-tools-extra/pseudo/gen/Main.cpp
+++ b/clang-tools-extra/pseudo/gen/Main.cpp
@@ -70,13 +70,13 @@ namespace {
// keyword: `INT` becomes `INT`;
// terminal: `IDENTIFIER` becomes `IDENTIFIER`;
std::string mangleSymbol(SymbolID SID, const Grammar &G) {
- static auto &TokNames = *new std::vector<std::string>{
-#define TOK(X) llvm::StringRef(#X).upper(),
-#define KEYWORD(Keyword, Condition) llvm::StringRef(#Keyword).upper(),
+ static char const * TokNames[] = {
+#define TOK(X) #X ,
+#define KEYWORD(Keyword, Condition) #Keyword ,
#include "clang/Basic/TokenKinds.def"
};
if (isToken(SID))
- return TokNames[symbolToToken(SID)];
+ return llvm::StringRef(TokNames[symbolToToken(SID)]).upper();
std::string Name = G.symbolName(SID).str();
// translation-unit -> translation_unit
std::replace(Name.begin(), Name.end(), '-', '_');
>From 94362c452d9743c6ee78f084e9e90baafeb45beb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
<chiheng.xu at gmail.com>
Date: Sun, 10 Dec 2023 15:38:56 +0800
Subject: [PATCH 2/2] 1
---
clang-tools-extra/pseudo/gen/Main.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/clang-tools-extra/pseudo/gen/Main.cpp b/clang-tools-extra/pseudo/gen/Main.cpp
index c9367ca16ed85e..2c0bf662ef405d 100644
--- a/clang-tools-extra/pseudo/gen/Main.cpp
+++ b/clang-tools-extra/pseudo/gen/Main.cpp
@@ -70,11 +70,11 @@ namespace {
// keyword: `INT` becomes `INT`;
// terminal: `IDENTIFIER` becomes `IDENTIFIER`;
std::string mangleSymbol(SymbolID SID, const Grammar &G) {
- static char const * TokNames[] = {
-#define TOK(X) #X ,
-#define KEYWORD(Keyword, Condition) #Keyword ,
+ static char const *TokNames[] = {
+#define TOK(X) #X,
+#define KEYWORD(Keyword, Condition) #Keyword,
#include "clang/Basic/TokenKinds.def"
- };
+ };
if (isToken(SID))
return llvm::StringRef(TokNames[symbolToToken(SID)]).upper();
std::string Name = G.symbolName(SID).str();
More information about the cfe-commits
mailing list