https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74983
From 02cbefc8112d73b11f835da30db4ed3344db9d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= <chiheng...@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 25cb26563837a..c9367ca16ed85 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 078dd3071d270c720f395e0cd98c5fdfcb3b1f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= <chiheng...@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 c9367ca16ed85..2c0bf662ef405 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(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits