diff --git a/packages/cxx-gen-ast/src/gen_ast_pretty_printer_cc.ts b/packages/cxx-gen-ast/src/gen_ast_pretty_printer_cc.ts index f779643b..c35658b2 100644 --- a/packages/cxx-gen-ast/src/gen_ast_pretty_printer_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_pretty_printer_cc.ts @@ -256,7 +256,7 @@ export function gen_ast_pretty_printer_cc({ nodes.forEach(({ name, members }) => { emit(); emit( - `void ASTPrettyPrinter::${className}Visitor::operator()(${name}* ast) {`, + `void ASTPrettyPrinter::${className}Visitor::operator()(${name}* ast) {` ); members.forEach((m) => { @@ -303,6 +303,10 @@ if (ast->op == TokenKind::T_NEW_ARRAY) { emit(`accept.write("{}", Token::spell(ast->op));`); } else { emit(`accept.writeToken(ast->${m.name});`); + + if (m.name == "captureDefaultLoc") { + emit(`if (ast->captureList) accept.write(",");`); + } } // post token @@ -331,7 +335,7 @@ if (ast->op == TokenKind::T_NEW_ARRAY) { if (isCommaSeparated(m, name)) { if (["enumeratorList"].includes(m.name)) { emit( - `if (it->next) { nospace(); accept.write(","); newline(); }`, + `if (it->next) { nospace(); accept.write(","); newline(); }` ); } else { emit(`if (it->next) { nospace(); accept.write(","); }`); diff --git a/src/parser/cxx/ast_pretty_printer.cc b/src/parser/cxx/ast_pretty_printer.cc index 961212ce..bf916152 100644 --- a/src/parser/cxx/ast_pretty_printer.cc +++ b/src/parser/cxx/ast_pretty_printer.cc @@ -2256,6 +2256,7 @@ void ASTPrettyPrinter::ExpressionVisitor::operator()(LambdaExpressionAST* ast) { } if (ast->captureDefaultLoc) { accept.writeToken(ast->captureDefaultLoc); + if (ast->captureList) accept.write(","); } for (auto it = ast->captureList; it; it = it->next) { diff --git a/src/parser/cxx/gcc_linux_toolchain.cc b/src/parser/cxx/gcc_linux_toolchain.cc index 20473d50..c5140270 100644 --- a/src/parser/cxx/gcc_linux_toolchain.cc +++ b/src/parser/cxx/gcc_linux_toolchain.cc @@ -29,7 +29,7 @@ namespace cxx { GCCLinuxToolchain::GCCLinuxToolchain(Preprocessor* preprocessor, std::string arch) : Toolchain(preprocessor), arch_(std::move(arch)) { - for (int version : {14, 13, 12, 11, 10, 9}) { + for (int version : {15, 14, 13, 12, 11, 10, 9}) { const auto path = fs::path( std::format("/usr/lib/gcc/{}-linux-gnu/{}/include", arch_, version)); diff --git a/src/parser/cxx/parser.cc b/src/parser/cxx/parser.cc index 92a4e354..a645adbd 100644 --- a/src/parser/cxx/parser.cc +++ b/src/parser/cxx/parser.cc @@ -181,15 +181,14 @@ Parser::Parser(TranslationUnit* unit) : unit(unit), binder_(unit) { globalScope_ = unit->globalScope(); setScope(globalScope_); - // temporary workarounds to the gnu until we have a proper + // temporary workarounds to GNU STL until we have a proper // support for templates mark_maybe_template_name(control_->getIdentifier("__remove_reference_t")); - // mark_maybe_template_name(control_->getIdentifier("__integer_pack")); - template_names_.insert(control_->getIdentifier("_S_invoke")); template_names_.insert(control_->getIdentifier("__type_pack_element")); template_names_.insert(control_->getIdentifier("__make_integer_seq")); template_names_.insert(control_->getIdentifier("_S_nothrow_construct")); + template_names_.insert(control_->getIdentifier("_S_nothrow_destroy")); } Parser::~Parser() = default;