[clang-tools-extra] 7b70c2e - [pseudo] Fix initializer of string table

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 02:04:18 PDT 2022


Author: Sam McCall
Date: 2022-07-27T11:04:12+02:00
New Revision: 7b70c2e75cd6b21cf9c2ea2f2ce5f7b9c4202549

URL: https://github.com/llvm/llvm-project/commit/7b70c2e75cd6b21cf9c2ea2f2ce5f7b9c4202549
DIFF: https://github.com/llvm/llvm-project/commit/7b70c2e75cd6b21cf9c2ea2f2ce5f7b9c4202549.diff

LOG: [pseudo] Fix initializer of string table

Apparently new string[/*no size*/]{"foo", "bar"} is a clang/gcc extension?

Added: 
    

Modified: 
    clang-tools-extra/pseudo/gen/Main.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/pseudo/gen/Main.cpp b/clang-tools-extra/pseudo/gen/Main.cpp
index 66980580d93b3..5cc33aa3f8b27 100644
--- a/clang-tools-extra/pseudo/gen/Main.cpp
+++ b/clang-tools-extra/pseudo/gen/Main.cpp
@@ -70,7 +70,7 @@ namespace {
 //   keyword: `INT` becomes `INT`;
 //   terminal: `IDENTIFIER` becomes `IDENTIFIER`;
 std::string mangleSymbol(SymbolID SID, const Grammar &G) {
-  static std::string *TokNames = new std::string[]{
+  static auto &TokNames = *new std::vector<std::string>{
 #define TOK(X) llvm::StringRef(#X).upper(),
 #define KEYWORD(Keyword, Condition) llvm::StringRef(#Keyword).upper(),
 #include "clang/Basic/TokenKinds.def"


        


More information about the cfe-commits mailing list