diff --git a/CMakeLists.txt b/CMakeLists.txt index aa7b3666..f8134969 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,22 +50,8 @@ endif() # if CMAKE_SYSTEM_NAME is WASI disable the exceptions if(CMAKE_SYSTEM_NAME STREQUAL "WASI") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") - - set(FMT_OS OFF CACHE BOOL "" FORCE) endif() -FetchContent_Declare( - fmt - GIT_REPOSITORY https://github.com/fmtlib/fmt - GIT_TAG 11.0.2 - GIT_SHALLOW 1 -) - -# set FMT_INSTALL to OFF to avoid installing fmt -set(FMT_INSTALL OFF CACHE BOOL "" FORCE) - -FetchContent_MakeAvailable(fmt) - FetchContent_Declare( utfcpp GIT_REPOSITORY https://github.com/nemtrif/utfcpp diff --git a/packages/cxx-gen-ast/src/gen_ast_dump_cc.ts b/packages/cxx-gen-ast/src/gen_ast_dump_cc.ts index a7e0837d..1a4969af 100644 --- a/packages/cxx-gen-ast/src/gen_ast_dump_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_dump_cc.ts @@ -40,8 +40,8 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) { if (member.kind === "node-list") { emit(` if (ast->${member.name}) {`); emit(` ++indent_;`); - emit(` out_ << cxx::format("{:{}}", "", indent_ * 2);`); - emit(` out_ << cxx::format("{}\\n", "${fieldName}");`); + emit(` out_ << std::format("{:{}}", "", indent_ * 2);`); + emit(` out_ << std::format("{}\\n", "${fieldName}");`); emit(` for (auto it = ast->${member.name}; it; it = it->next) {`); emit(` accept(it->value);`); emit(` }`); @@ -54,25 +54,25 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) { } else if (member.kind == "attribute" && member.type === "bool") { emit(` if (ast->${member.name}) {`); emit(` ++indent_;`); - emit(` out_ << cxx::format("{:{}}", "", indent_ * 2);`); + emit(` out_ << std::format("{:{}}", "", indent_ * 2);`); emit( - ` out_ << cxx::format("${fieldName}: {}\\n", ast->${member.name});`, + ` out_ << std::format("${fieldName}: {}\\n", ast->${member.name});` ); emit(` --indent_;`); emit(` }`); } else if (member.kind == "attribute" && member.type === "int") { emit(` ++indent_;`); - emit(` out_ << cxx::format("{:{}}", "", indent_ * 2);`); + emit(` out_ << std::format("{:{}}", "", indent_ * 2);`); emit( - ` out_ << cxx::format("${fieldName}: {}\\n", ast->${member.name});`, + ` out_ << std::format("${fieldName}: {}\\n", ast->${member.name});` ); emit(` --indent_;`); } else if (member.kind == "attribute" && member.type.endsWith("Literal")) { emit(` if (ast->${member.name}) {`); emit(` ++indent_;`); - emit(` out_ << cxx::format("{:{}}", "", indent_ * 2);`); + emit(` out_ << std::format("{:{}}", "", indent_ * 2);`); emit( - ` out_ << cxx::format("${fieldName}: {}\\n", ast->${member.name}->value());`, + ` out_ << std::format("${fieldName}: {}\\n", ast->${member.name}->value());` ); emit(` --indent_;`); emit(` }`); @@ -82,9 +82,9 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) { ) { emit(` if (ast->${member.name} != TokenKind::T_EOF_SYMBOL) {`); emit(` ++indent_;`); - emit(` out_ << cxx::format("{:{}}", "", indent_ * 2);`); + emit(` out_ << std::format("{:{}}", "", indent_ * 2);`); emit( - ` out_ << cxx::format("${fieldName}: {}\\n", Token::spell(ast->${member.name}));`, + ` out_ << std::format("${fieldName}: {}\\n", Token::spell(ast->${member.name}));` ); emit(` --indent_;`); emit(` }`); @@ -93,9 +93,9 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) { member.type == "ImplicitCastKind" ) { emit(` ++indent_;`); - emit(` out_ << cxx::format("{:{}}", "", indent_ * 2);`); + emit(` out_ << std::format("{:{}}", "", indent_ * 2);`); emit( - ` out_ << cxx::format("${fieldName}: {}\\n", to_string(ast->${member.name}));`, + ` out_ << std::format("${fieldName}: {}\\n", to_string(ast->${member.name}));` ); emit(` --indent_;`); } @@ -105,7 +105,7 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) { nodes.forEach(({ name, base, members }) => { emit(); emit(`void ASTPrinter::visit(${name}* ast) {`); - emit(` out_ << cxx::format("{}\\n", "${astName(name)}");`); + emit(` out_ << std::format("{}\\n", "${astName(name)}");`); const baseMembers = ast.baseMembers.get(base); @@ -135,7 +135,7 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) { #include #include #include -#include +#include #include #include @@ -153,9 +153,9 @@ void ASTPrinter::operator()(AST* ast) { void ASTPrinter::accept(AST* ast, std::string_view field) { if (!ast) return; ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); + out_ << std::format("{:{}}", "", indent_ * 2); if (!field.empty()) { - out_ << cxx::format("{}: ", field); + out_ << std::format("{}: ", field); } ast->accept(this); --indent_; @@ -164,9 +164,9 @@ void ASTPrinter::accept(AST* ast, std::string_view field) { void ASTPrinter::accept(const Identifier* id, std::string_view field) { if (!id) return; ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - if (!field.empty()) out_ << cxx::format("{}: ", field); - out_ << cxx::format("{}\\n", id->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + if (!field.empty()) out_ << std::format("{}: ", field); + out_ << std::format("{}\\n", id->value()); --indent_; } diff --git a/packages/cxx-gen-ast/src/gen_ast_encoder_cc.ts b/packages/cxx-gen-ast/src/gen_ast_encoder_cc.ts index 3f3519fd..7de53438 100644 --- a/packages/cxx-gen-ast/src/gen_ast_encoder_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_encoder_cc.ts @@ -44,7 +44,7 @@ export function gen_ast_encoder_cc({ const emitLiteral = ( m: Attribute, table: string, - finalizers: (() => void)[], + finalizers: (() => void)[] ) => { const fieldName = toSnakeName(m.name); @@ -70,7 +70,7 @@ export function gen_ast_encoder_cc({ const className = makeClassName(base); emit(); emit( - ` auto ASTEncoder::accept${className}(${base}* ast) -> std::tuple, std::uint32_t> {`, + ` auto ASTEncoder::accept${className}(${base}* ast) -> std::tuple, std::uint32_t> {` ); emit(` if (!ast) return {};`); emit(` flatbuffers::Offset<> offset;`); @@ -201,7 +201,7 @@ export function gen_ast_encoder_cc({ #include #include #include -#include +#include #include diff --git a/src/frontend/cxx/ast_printer.cc b/src/frontend/cxx/ast_printer.cc index 037c0ee6..89d47974 100644 --- a/src/frontend/cxx/ast_printer.cc +++ b/src/frontend/cxx/ast_printer.cc @@ -23,10 +23,10 @@ #include #include #include -#include #include #include +#include #include namespace cxx { @@ -39,9 +39,9 @@ void ASTPrinter::operator()(AST* ast) { accept(ast); } void ASTPrinter::accept(AST* ast, std::string_view field) { if (!ast) return; ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); + out_ << std::format("{:{}}", "", indent_ * 2); if (!field.empty()) { - out_ << cxx::format("{}: ", field); + out_ << std::format("{}: ", field); } ast->accept(this); --indent_; @@ -50,18 +50,18 @@ void ASTPrinter::accept(AST* ast, std::string_view field) { void ASTPrinter::accept(const Identifier* id, std::string_view field) { if (!id) return; ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - if (!field.empty()) out_ << cxx::format("{}: ", field); - out_ << cxx::format("{}\n", id->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + if (!field.empty()) out_ << std::format("{}: ", field); + out_ << std::format("{}\n", id->value()); --indent_; } void ASTPrinter::visit(TranslationUnitAST* ast) { - out_ << cxx::format("{}\n", "translation-unit"); + out_ << std::format("{}\n", "translation-unit"); if (ast->declarationList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "declaration-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declaration-list"); for (auto it = ast->declarationList; it; it = it->next) { accept(it->value); } @@ -70,13 +70,13 @@ void ASTPrinter::visit(TranslationUnitAST* ast) { } void ASTPrinter::visit(ModuleUnitAST* ast) { - out_ << cxx::format("{}\n", "module-unit"); + out_ << std::format("{}\n", "module-unit"); accept(ast->globalModuleFragment, "global-module-fragment"); accept(ast->moduleDeclaration, "module-declaration"); if (ast->declarationList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "declaration-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declaration-list"); for (auto it = ast->declarationList; it; it = it->next) { accept(it->value); } @@ -86,11 +86,11 @@ void ASTPrinter::visit(ModuleUnitAST* ast) { } void ASTPrinter::visit(SimpleDeclarationAST* ast) { - out_ << cxx::format("{}\n", "simple-declaration"); + out_ << std::format("{}\n", "simple-declaration"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -98,8 +98,8 @@ void ASTPrinter::visit(SimpleDeclarationAST* ast) { } if (ast->declSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "decl-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "decl-specifier-list"); for (auto it = ast->declSpecifierList; it; it = it->next) { accept(it->value); } @@ -107,8 +107,8 @@ void ASTPrinter::visit(SimpleDeclarationAST* ast) { } if (ast->initDeclaratorList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "init-declarator-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "init-declarator-list"); for (auto it = ast->initDeclaratorList; it; it = it->next) { accept(it->value); } @@ -118,17 +118,17 @@ void ASTPrinter::visit(SimpleDeclarationAST* ast) { } void ASTPrinter::visit(AsmDeclarationAST* ast) { - out_ << cxx::format("{}\n", "asm-declaration"); + out_ << std::format("{}\n", "asm-declaration"); if (ast->literal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", ast->literal->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", ast->literal->value()); --indent_; } if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -136,8 +136,8 @@ void ASTPrinter::visit(AsmDeclarationAST* ast) { } if (ast->asmQualifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "asm-qualifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "asm-qualifier-list"); for (auto it = ast->asmQualifierList; it; it = it->next) { accept(it->value); } @@ -145,8 +145,8 @@ void ASTPrinter::visit(AsmDeclarationAST* ast) { } if (ast->outputOperandList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "output-operand-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "output-operand-list"); for (auto it = ast->outputOperandList; it; it = it->next) { accept(it->value); } @@ -154,8 +154,8 @@ void ASTPrinter::visit(AsmDeclarationAST* ast) { } if (ast->inputOperandList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "input-operand-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "input-operand-list"); for (auto it = ast->inputOperandList; it; it = it->next) { accept(it->value); } @@ -163,8 +163,8 @@ void ASTPrinter::visit(AsmDeclarationAST* ast) { } if (ast->clobberList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "clobber-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "clobber-list"); for (auto it = ast->clobberList; it; it = it->next) { accept(it->value); } @@ -172,8 +172,8 @@ void ASTPrinter::visit(AsmDeclarationAST* ast) { } if (ast->gotoLabelList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "goto-label-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "goto-label-list"); for (auto it = ast->gotoLabelList; it; it = it->next) { accept(it->value); } @@ -182,18 +182,18 @@ void ASTPrinter::visit(AsmDeclarationAST* ast) { } void ASTPrinter::visit(NamespaceAliasDefinitionAST* ast) { - out_ << cxx::format("{}\n", "namespace-alias-definition"); + out_ << std::format("{}\n", "namespace-alias-definition"); accept(ast->identifier, "identifier"); accept(ast->nestedNameSpecifier, "nested-name-specifier"); accept(ast->unqualifiedId, "unqualified-id"); } void ASTPrinter::visit(UsingDeclarationAST* ast) { - out_ << cxx::format("{}\n", "using-declaration"); + out_ << std::format("{}\n", "using-declaration"); if (ast->usingDeclaratorList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "using-declarator-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "using-declarator-list"); for (auto it = ast->usingDeclaratorList; it; it = it->next) { accept(it->value); } @@ -202,16 +202,16 @@ void ASTPrinter::visit(UsingDeclarationAST* ast) { } void ASTPrinter::visit(UsingEnumDeclarationAST* ast) { - out_ << cxx::format("{}\n", "using-enum-declaration"); + out_ << std::format("{}\n", "using-enum-declaration"); accept(ast->enumTypeSpecifier, "enum-type-specifier"); } void ASTPrinter::visit(UsingDirectiveAST* ast) { - out_ << cxx::format("{}\n", "using-directive"); + out_ << std::format("{}\n", "using-directive"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -222,23 +222,23 @@ void ASTPrinter::visit(UsingDirectiveAST* ast) { } void ASTPrinter::visit(StaticAssertDeclarationAST* ast) { - out_ << cxx::format("{}\n", "static-assert-declaration"); + out_ << std::format("{}\n", "static-assert-declaration"); if (ast->literal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", ast->literal->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", ast->literal->value()); --indent_; } accept(ast->expression, "expression"); } void ASTPrinter::visit(AliasDeclarationAST* ast) { - out_ << cxx::format("{}\n", "alias-declaration"); + out_ << std::format("{}\n", "alias-declaration"); accept(ast->identifier, "identifier"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -246,8 +246,8 @@ void ASTPrinter::visit(AliasDeclarationAST* ast) { } if (ast->gnuAttributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "gnu-attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "gnu-attribute-list"); for (auto it = ast->gnuAttributeList; it; it = it->next) { accept(it->value); } @@ -257,11 +257,11 @@ void ASTPrinter::visit(AliasDeclarationAST* ast) { } void ASTPrinter::visit(OpaqueEnumDeclarationAST* ast) { - out_ << cxx::format("{}\n", "opaque-enum-declaration"); + out_ << std::format("{}\n", "opaque-enum-declaration"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -271,8 +271,8 @@ void ASTPrinter::visit(OpaqueEnumDeclarationAST* ast) { accept(ast->unqualifiedId, "unqualified-id"); if (ast->typeSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "type-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "type-specifier-list"); for (auto it = ast->typeSpecifierList; it; it = it->next) { accept(it->value); } @@ -281,11 +281,11 @@ void ASTPrinter::visit(OpaqueEnumDeclarationAST* ast) { } void ASTPrinter::visit(FunctionDefinitionAST* ast) { - out_ << cxx::format("{}\n", "function-definition"); + out_ << std::format("{}\n", "function-definition"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -293,8 +293,8 @@ void ASTPrinter::visit(FunctionDefinitionAST* ast) { } if (ast->declSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "decl-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "decl-specifier-list"); for (auto it = ast->declSpecifierList; it; it = it->next) { accept(it->value); } @@ -306,11 +306,11 @@ void ASTPrinter::visit(FunctionDefinitionAST* ast) { } void ASTPrinter::visit(TemplateDeclarationAST* ast) { - out_ << cxx::format("{}\n", "template-declaration"); + out_ << std::format("{}\n", "template-declaration"); if (ast->templateParameterList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "template-parameter-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "template-parameter-list"); for (auto it = ast->templateParameterList; it; it = it->next) { accept(it->value); } @@ -321,13 +321,13 @@ void ASTPrinter::visit(TemplateDeclarationAST* ast) { } void ASTPrinter::visit(ConceptDefinitionAST* ast) { - out_ << cxx::format("{}\n", "concept-definition"); + out_ << std::format("{}\n", "concept-definition"); accept(ast->identifier, "identifier"); accept(ast->expression, "expression"); } void ASTPrinter::visit(DeductionGuideAST* ast) { - out_ << cxx::format("{}\n", "deduction-guide"); + out_ << std::format("{}\n", "deduction-guide"); accept(ast->identifier, "identifier"); accept(ast->explicitSpecifier, "explicit-specifier"); accept(ast->parameterDeclarationClause, "parameter-declaration-clause"); @@ -335,21 +335,21 @@ void ASTPrinter::visit(DeductionGuideAST* ast) { } void ASTPrinter::visit(ExplicitInstantiationAST* ast) { - out_ << cxx::format("{}\n", "explicit-instantiation"); + out_ << std::format("{}\n", "explicit-instantiation"); accept(ast->declaration, "declaration"); } void ASTPrinter::visit(ExportDeclarationAST* ast) { - out_ << cxx::format("{}\n", "export-declaration"); + out_ << std::format("{}\n", "export-declaration"); accept(ast->declaration, "declaration"); } void ASTPrinter::visit(ExportCompoundDeclarationAST* ast) { - out_ << cxx::format("{}\n", "export-compound-declaration"); + out_ << std::format("{}\n", "export-compound-declaration"); if (ast->declarationList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "declaration-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declaration-list"); for (auto it = ast->declarationList; it; it = it->next) { accept(it->value); } @@ -358,17 +358,17 @@ void ASTPrinter::visit(ExportCompoundDeclarationAST* ast) { } void ASTPrinter::visit(LinkageSpecificationAST* ast) { - out_ << cxx::format("{}\n", "linkage-specification"); + out_ << std::format("{}\n", "linkage-specification"); if (ast->stringLiteral) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("string-literal: {}\n", ast->stringLiteral->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("string-literal: {}\n", ast->stringLiteral->value()); --indent_; } if (ast->declarationList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "declaration-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declaration-list"); for (auto it = ast->declarationList; it; it = it->next) { accept(it->value); } @@ -377,18 +377,18 @@ void ASTPrinter::visit(LinkageSpecificationAST* ast) { } void ASTPrinter::visit(NamespaceDefinitionAST* ast) { - out_ << cxx::format("{}\n", "namespace-definition"); + out_ << std::format("{}\n", "namespace-definition"); accept(ast->identifier, "identifier"); if (ast->isInline) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-inline: {}\n", ast->isInline); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-inline: {}\n", ast->isInline); --indent_; } if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -396,8 +396,8 @@ void ASTPrinter::visit(NamespaceDefinitionAST* ast) { } if (ast->nestedNamespaceSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "nested-namespace-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "nested-namespace-specifier-list"); for (auto it = ast->nestedNamespaceSpecifierList; it; it = it->next) { accept(it->value); } @@ -405,8 +405,8 @@ void ASTPrinter::visit(NamespaceDefinitionAST* ast) { } if (ast->extraAttributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "extra-attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "extra-attribute-list"); for (auto it = ast->extraAttributeList; it; it = it->next) { accept(it->value); } @@ -414,8 +414,8 @@ void ASTPrinter::visit(NamespaceDefinitionAST* ast) { } if (ast->declarationList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "declaration-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declaration-list"); for (auto it = ast->declarationList; it; it = it->next) { accept(it->value); } @@ -424,15 +424,15 @@ void ASTPrinter::visit(NamespaceDefinitionAST* ast) { } void ASTPrinter::visit(EmptyDeclarationAST* ast) { - out_ << cxx::format("{}\n", "empty-declaration"); + out_ << std::format("{}\n", "empty-declaration"); } void ASTPrinter::visit(AttributeDeclarationAST* ast) { - out_ << cxx::format("{}\n", "attribute-declaration"); + out_ << std::format("{}\n", "attribute-declaration"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -441,12 +441,12 @@ void ASTPrinter::visit(AttributeDeclarationAST* ast) { } void ASTPrinter::visit(ModuleImportDeclarationAST* ast) { - out_ << cxx::format("{}\n", "module-import-declaration"); + out_ << std::format("{}\n", "module-import-declaration"); accept(ast->importName, "import-name"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -455,24 +455,24 @@ void ASTPrinter::visit(ModuleImportDeclarationAST* ast) { } void ASTPrinter::visit(ParameterDeclarationAST* ast) { - out_ << cxx::format("{}\n", "parameter-declaration"); + out_ << std::format("{}\n", "parameter-declaration"); accept(ast->identifier, "identifier"); if (ast->isThisIntroduced) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-this-introduced: {}\n", ast->isThisIntroduced); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-this-introduced: {}\n", ast->isThisIntroduced); --indent_; } if (ast->isPack) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-pack: {}\n", ast->isPack); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-pack: {}\n", ast->isPack); --indent_; } if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -480,8 +480,8 @@ void ASTPrinter::visit(ParameterDeclarationAST* ast) { } if (ast->typeSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "type-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "type-specifier-list"); for (auto it = ast->typeSpecifierList; it; it = it->next) { accept(it->value); } @@ -492,26 +492,26 @@ void ASTPrinter::visit(ParameterDeclarationAST* ast) { } void ASTPrinter::visit(AccessDeclarationAST* ast) { - out_ << cxx::format("{}\n", "access-declaration"); + out_ << std::format("{}\n", "access-declaration"); if (ast->accessSpecifier != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("access-specifier: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("access-specifier: {}\n", Token::spell(ast->accessSpecifier)); --indent_; } } void ASTPrinter::visit(ForRangeDeclarationAST* ast) { - out_ << cxx::format("{}\n", "for-range-declaration"); + out_ << std::format("{}\n", "for-range-declaration"); } void ASTPrinter::visit(StructuredBindingDeclarationAST* ast) { - out_ << cxx::format("{}\n", "structured-binding-declaration"); + out_ << std::format("{}\n", "structured-binding-declaration"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -519,8 +519,8 @@ void ASTPrinter::visit(StructuredBindingDeclarationAST* ast) { } if (ast->declSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "decl-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "decl-specifier-list"); for (auto it = ast->declSpecifierList; it; it = it->next) { accept(it->value); } @@ -528,8 +528,8 @@ void ASTPrinter::visit(StructuredBindingDeclarationAST* ast) { } if (ast->bindingList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "binding-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "binding-list"); for (auto it = ast->bindingList; it; it = it->next) { accept(it->value); } @@ -539,12 +539,12 @@ void ASTPrinter::visit(StructuredBindingDeclarationAST* ast) { } void ASTPrinter::visit(AsmOperandAST* ast) { - out_ << cxx::format("{}\n", "asm-operand"); + out_ << std::format("{}\n", "asm-operand"); accept(ast->symbolicName, "symbolic-name"); if (ast->constraintLiteral) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("constraint-literal: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("constraint-literal: {}\n", ast->constraintLiteral->value()); --indent_; } @@ -552,55 +552,55 @@ void ASTPrinter::visit(AsmOperandAST* ast) { } void ASTPrinter::visit(AsmQualifierAST* ast) { - out_ << cxx::format("{}\n", "asm-qualifier"); + out_ << std::format("{}\n", "asm-qualifier"); if (ast->qualifier != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("qualifier: {}\n", Token::spell(ast->qualifier)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("qualifier: {}\n", Token::spell(ast->qualifier)); --indent_; } } void ASTPrinter::visit(AsmClobberAST* ast) { - out_ << cxx::format("{}\n", "asm-clobber"); + out_ << std::format("{}\n", "asm-clobber"); if (ast->literal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", ast->literal->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", ast->literal->value()); --indent_; } } void ASTPrinter::visit(AsmGotoLabelAST* ast) { - out_ << cxx::format("{}\n", "asm-goto-label"); + out_ << std::format("{}\n", "asm-goto-label"); accept(ast->identifier, "identifier"); } void ASTPrinter::visit(LabeledStatementAST* ast) { - out_ << cxx::format("{}\n", "labeled-statement"); + out_ << std::format("{}\n", "labeled-statement"); accept(ast->identifier, "identifier"); } void ASTPrinter::visit(CaseStatementAST* ast) { - out_ << cxx::format("{}\n", "case-statement"); + out_ << std::format("{}\n", "case-statement"); accept(ast->expression, "expression"); } void ASTPrinter::visit(DefaultStatementAST* ast) { - out_ << cxx::format("{}\n", "default-statement"); + out_ << std::format("{}\n", "default-statement"); } void ASTPrinter::visit(ExpressionStatementAST* ast) { - out_ << cxx::format("{}\n", "expression-statement"); + out_ << std::format("{}\n", "expression-statement"); accept(ast->expression, "expression"); } void ASTPrinter::visit(CompoundStatementAST* ast) { - out_ << cxx::format("{}\n", "compound-statement"); + out_ << std::format("{}\n", "compound-statement"); if (ast->statementList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "statement-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "statement-list"); for (auto it = ast->statementList; it; it = it->next) { accept(it->value); } @@ -609,7 +609,7 @@ void ASTPrinter::visit(CompoundStatementAST* ast) { } void ASTPrinter::visit(IfStatementAST* ast) { - out_ << cxx::format("{}\n", "if-statement"); + out_ << std::format("{}\n", "if-statement"); accept(ast->initializer, "initializer"); accept(ast->condition, "condition"); accept(ast->statement, "statement"); @@ -617,11 +617,11 @@ void ASTPrinter::visit(IfStatementAST* ast) { } void ASTPrinter::visit(ConstevalIfStatementAST* ast) { - out_ << cxx::format("{}\n", "consteval-if-statement"); + out_ << std::format("{}\n", "consteval-if-statement"); if (ast->isNot) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-not: {}\n", ast->isNot); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-not: {}\n", ast->isNot); --indent_; } accept(ast->statement, "statement"); @@ -629,26 +629,26 @@ void ASTPrinter::visit(ConstevalIfStatementAST* ast) { } void ASTPrinter::visit(SwitchStatementAST* ast) { - out_ << cxx::format("{}\n", "switch-statement"); + out_ << std::format("{}\n", "switch-statement"); accept(ast->initializer, "initializer"); accept(ast->condition, "condition"); accept(ast->statement, "statement"); } void ASTPrinter::visit(WhileStatementAST* ast) { - out_ << cxx::format("{}\n", "while-statement"); + out_ << std::format("{}\n", "while-statement"); accept(ast->condition, "condition"); accept(ast->statement, "statement"); } void ASTPrinter::visit(DoStatementAST* ast) { - out_ << cxx::format("{}\n", "do-statement"); + out_ << std::format("{}\n", "do-statement"); accept(ast->statement, "statement"); accept(ast->expression, "expression"); } void ASTPrinter::visit(ForRangeStatementAST* ast) { - out_ << cxx::format("{}\n", "for-range-statement"); + out_ << std::format("{}\n", "for-range-statement"); accept(ast->initializer, "initializer"); accept(ast->rangeDeclaration, "range-declaration"); accept(ast->rangeInitializer, "range-initializer"); @@ -656,7 +656,7 @@ void ASTPrinter::visit(ForRangeStatementAST* ast) { } void ASTPrinter::visit(ForStatementAST* ast) { - out_ << cxx::format("{}\n", "for-statement"); + out_ << std::format("{}\n", "for-statement"); accept(ast->initializer, "initializer"); accept(ast->condition, "condition"); accept(ast->expression, "expression"); @@ -664,40 +664,40 @@ void ASTPrinter::visit(ForStatementAST* ast) { } void ASTPrinter::visit(BreakStatementAST* ast) { - out_ << cxx::format("{}\n", "break-statement"); + out_ << std::format("{}\n", "break-statement"); } void ASTPrinter::visit(ContinueStatementAST* ast) { - out_ << cxx::format("{}\n", "continue-statement"); + out_ << std::format("{}\n", "continue-statement"); } void ASTPrinter::visit(ReturnStatementAST* ast) { - out_ << cxx::format("{}\n", "return-statement"); + out_ << std::format("{}\n", "return-statement"); accept(ast->expression, "expression"); } void ASTPrinter::visit(CoroutineReturnStatementAST* ast) { - out_ << cxx::format("{}\n", "coroutine-return-statement"); + out_ << std::format("{}\n", "coroutine-return-statement"); accept(ast->expression, "expression"); } void ASTPrinter::visit(GotoStatementAST* ast) { - out_ << cxx::format("{}\n", "goto-statement"); + out_ << std::format("{}\n", "goto-statement"); accept(ast->identifier, "identifier"); } void ASTPrinter::visit(DeclarationStatementAST* ast) { - out_ << cxx::format("{}\n", "declaration-statement"); + out_ << std::format("{}\n", "declaration-statement"); accept(ast->declaration, "declaration"); } void ASTPrinter::visit(TryBlockStatementAST* ast) { - out_ << cxx::format("{}\n", "try-block-statement"); + out_ << std::format("{}\n", "try-block-statement"); accept(ast->statement, "statement"); if (ast->handlerList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "handler-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "handler-list"); for (auto it = ast->handlerList; it; it = it->next) { accept(it->value); } @@ -706,94 +706,94 @@ void ASTPrinter::visit(TryBlockStatementAST* ast) { } void ASTPrinter::visit(GeneratedLiteralExpressionAST* ast) { - out_ << cxx::format("{}\n", "generated-literal-expression"); + out_ << std::format("{}\n", "generated-literal-expression"); } void ASTPrinter::visit(CharLiteralExpressionAST* ast) { - out_ << cxx::format("{}\n", "char-literal-expression"); + out_ << std::format("{}\n", "char-literal-expression"); if (ast->literal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", ast->literal->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", ast->literal->value()); --indent_; } } void ASTPrinter::visit(BoolLiteralExpressionAST* ast) { - out_ << cxx::format("{}\n", "bool-literal-expression"); + out_ << std::format("{}\n", "bool-literal-expression"); if (ast->isTrue) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-true: {}\n", ast->isTrue); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-true: {}\n", ast->isTrue); --indent_; } } void ASTPrinter::visit(IntLiteralExpressionAST* ast) { - out_ << cxx::format("{}\n", "int-literal-expression"); + out_ << std::format("{}\n", "int-literal-expression"); if (ast->literal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", ast->literal->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", ast->literal->value()); --indent_; } } void ASTPrinter::visit(FloatLiteralExpressionAST* ast) { - out_ << cxx::format("{}\n", "float-literal-expression"); + out_ << std::format("{}\n", "float-literal-expression"); if (ast->literal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", ast->literal->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", ast->literal->value()); --indent_; } } void ASTPrinter::visit(NullptrLiteralExpressionAST* ast) { - out_ << cxx::format("{}\n", "nullptr-literal-expression"); + out_ << std::format("{}\n", "nullptr-literal-expression"); if (ast->literal != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", Token::spell(ast->literal)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", Token::spell(ast->literal)); --indent_; } } void ASTPrinter::visit(StringLiteralExpressionAST* ast) { - out_ << cxx::format("{}\n", "string-literal-expression"); + out_ << std::format("{}\n", "string-literal-expression"); if (ast->literal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", ast->literal->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", ast->literal->value()); --indent_; } } void ASTPrinter::visit(UserDefinedStringLiteralExpressionAST* ast) { - out_ << cxx::format("{}\n", "user-defined-string-literal-expression"); + out_ << std::format("{}\n", "user-defined-string-literal-expression"); if (ast->literal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", ast->literal->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", ast->literal->value()); --indent_; } } void ASTPrinter::visit(ThisExpressionAST* ast) { - out_ << cxx::format("{}\n", "this-expression"); + out_ << std::format("{}\n", "this-expression"); } void ASTPrinter::visit(NestedExpressionAST* ast) { - out_ << cxx::format("{}\n", "nested-expression"); + out_ << std::format("{}\n", "nested-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(IdExpressionAST* ast) { - out_ << cxx::format("{}\n", "id-expression"); + out_ << std::format("{}\n", "id-expression"); if (ast->isTemplateIntroduced) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-template-introduced: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-template-introduced: {}\n", ast->isTemplateIntroduced); --indent_; } @@ -802,18 +802,18 @@ void ASTPrinter::visit(IdExpressionAST* ast) { } void ASTPrinter::visit(LambdaExpressionAST* ast) { - out_ << cxx::format("{}\n", "lambda-expression"); + out_ << std::format("{}\n", "lambda-expression"); if (ast->captureDefault != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("capture-default: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("capture-default: {}\n", Token::spell(ast->captureDefault)); --indent_; } if (ast->captureList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "capture-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "capture-list"); for (auto it = ast->captureList; it; it = it->next) { accept(it->value); } @@ -821,8 +821,8 @@ void ASTPrinter::visit(LambdaExpressionAST* ast) { } if (ast->templateParameterList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "template-parameter-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "template-parameter-list"); for (auto it = ast->templateParameterList; it; it = it->next) { accept(it->value); } @@ -832,8 +832,8 @@ void ASTPrinter::visit(LambdaExpressionAST* ast) { accept(ast->parameterDeclarationClause, "parameter-declaration-clause"); if (ast->gnuAtributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "gnu-atribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "gnu-atribute-list"); for (auto it = ast->gnuAtributeList; it; it = it->next) { accept(it->value); } @@ -841,8 +841,8 @@ void ASTPrinter::visit(LambdaExpressionAST* ast) { } if (ast->lambdaSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "lambda-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "lambda-specifier-list"); for (auto it = ast->lambdaSpecifierList; it; it = it->next) { accept(it->value); } @@ -851,8 +851,8 @@ void ASTPrinter::visit(LambdaExpressionAST* ast) { accept(ast->exceptionSpecifier, "exception-specifier"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -864,17 +864,17 @@ void ASTPrinter::visit(LambdaExpressionAST* ast) { } void ASTPrinter::visit(FoldExpressionAST* ast) { - out_ << cxx::format("{}\n", "fold-expression"); + out_ << std::format("{}\n", "fold-expression"); if (ast->op != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("op: {}\n", Token::spell(ast->op)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("op: {}\n", Token::spell(ast->op)); --indent_; } if (ast->foldOp != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("fold-op: {}\n", Token::spell(ast->foldOp)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("fold-op: {}\n", Token::spell(ast->foldOp)); --indent_; } accept(ast->leftExpression, "left-expression"); @@ -882,34 +882,34 @@ void ASTPrinter::visit(FoldExpressionAST* ast) { } void ASTPrinter::visit(RightFoldExpressionAST* ast) { - out_ << cxx::format("{}\n", "right-fold-expression"); + out_ << std::format("{}\n", "right-fold-expression"); if (ast->op != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("op: {}\n", Token::spell(ast->op)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("op: {}\n", Token::spell(ast->op)); --indent_; } accept(ast->expression, "expression"); } void ASTPrinter::visit(LeftFoldExpressionAST* ast) { - out_ << cxx::format("{}\n", "left-fold-expression"); + out_ << std::format("{}\n", "left-fold-expression"); if (ast->op != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("op: {}\n", Token::spell(ast->op)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("op: {}\n", Token::spell(ast->op)); --indent_; } accept(ast->expression, "expression"); } void ASTPrinter::visit(RequiresExpressionAST* ast) { - out_ << cxx::format("{}\n", "requires-expression"); + out_ << std::format("{}\n", "requires-expression"); accept(ast->parameterDeclarationClause, "parameter-declaration-clause"); if (ast->requirementList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "requirement-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "requirement-list"); for (auto it = ast->requirementList; it; it = it->next) { accept(it->value); } @@ -918,24 +918,24 @@ void ASTPrinter::visit(RequiresExpressionAST* ast) { } void ASTPrinter::visit(VaArgExpressionAST* ast) { - out_ << cxx::format("{}\n", "va-arg-expression"); + out_ << std::format("{}\n", "va-arg-expression"); accept(ast->expression, "expression"); accept(ast->typeId, "type-id"); } void ASTPrinter::visit(SubscriptExpressionAST* ast) { - out_ << cxx::format("{}\n", "subscript-expression"); + out_ << std::format("{}\n", "subscript-expression"); accept(ast->baseExpression, "base-expression"); accept(ast->indexExpression, "index-expression"); } void ASTPrinter::visit(CallExpressionAST* ast) { - out_ << cxx::format("{}\n", "call-expression"); + out_ << std::format("{}\n", "call-expression"); accept(ast->baseExpression, "base-expression"); if (ast->expressionList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "expression-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "expression-list"); for (auto it = ast->expressionList; it; it = it->next) { accept(it->value); } @@ -944,12 +944,12 @@ void ASTPrinter::visit(CallExpressionAST* ast) { } void ASTPrinter::visit(TypeConstructionAST* ast) { - out_ << cxx::format("{}\n", "type-construction"); + out_ << std::format("{}\n", "type-construction"); accept(ast->typeSpecifier, "type-specifier"); if (ast->expressionList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "expression-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "expression-list"); for (auto it = ast->expressionList; it; it = it->next) { accept(it->value); } @@ -958,23 +958,23 @@ void ASTPrinter::visit(TypeConstructionAST* ast) { } void ASTPrinter::visit(BracedTypeConstructionAST* ast) { - out_ << cxx::format("{}\n", "braced-type-construction"); + out_ << std::format("{}\n", "braced-type-construction"); accept(ast->typeSpecifier, "type-specifier"); accept(ast->bracedInitList, "braced-init-list"); } void ASTPrinter::visit(SpliceMemberExpressionAST* ast) { - out_ << cxx::format("{}\n", "splice-member-expression"); + out_ << std::format("{}\n", "splice-member-expression"); if (ast->accessOp != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("access-op: {}\n", Token::spell(ast->accessOp)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("access-op: {}\n", Token::spell(ast->accessOp)); --indent_; } if (ast->isTemplateIntroduced) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-template-introduced: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-template-introduced: {}\n", ast->isTemplateIntroduced); --indent_; } @@ -983,17 +983,17 @@ void ASTPrinter::visit(SpliceMemberExpressionAST* ast) { } void ASTPrinter::visit(MemberExpressionAST* ast) { - out_ << cxx::format("{}\n", "member-expression"); + out_ << std::format("{}\n", "member-expression"); if (ast->accessOp != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("access-op: {}\n", Token::spell(ast->accessOp)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("access-op: {}\n", Token::spell(ast->accessOp)); --indent_; } if (ast->isTemplateIntroduced) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-template-introduced: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-template-introduced: {}\n", ast->isTemplateIntroduced); --indent_; } @@ -1003,115 +1003,115 @@ void ASTPrinter::visit(MemberExpressionAST* ast) { } void ASTPrinter::visit(PostIncrExpressionAST* ast) { - out_ << cxx::format("{}\n", "post-incr-expression"); + out_ << std::format("{}\n", "post-incr-expression"); if (ast->op != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("op: {}\n", Token::spell(ast->op)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("op: {}\n", Token::spell(ast->op)); --indent_; } accept(ast->baseExpression, "base-expression"); } void ASTPrinter::visit(CppCastExpressionAST* ast) { - out_ << cxx::format("{}\n", "cpp-cast-expression"); + out_ << std::format("{}\n", "cpp-cast-expression"); accept(ast->typeId, "type-id"); accept(ast->expression, "expression"); } void ASTPrinter::visit(BuiltinBitCastExpressionAST* ast) { - out_ << cxx::format("{}\n", "builtin-bit-cast-expression"); + out_ << std::format("{}\n", "builtin-bit-cast-expression"); accept(ast->typeId, "type-id"); accept(ast->expression, "expression"); } void ASTPrinter::visit(TypeidExpressionAST* ast) { - out_ << cxx::format("{}\n", "typeid-expression"); + out_ << std::format("{}\n", "typeid-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(TypeidOfTypeExpressionAST* ast) { - out_ << cxx::format("{}\n", "typeid-of-type-expression"); + out_ << std::format("{}\n", "typeid-of-type-expression"); accept(ast->typeId, "type-id"); } void ASTPrinter::visit(SpliceExpressionAST* ast) { - out_ << cxx::format("{}\n", "splice-expression"); + out_ << std::format("{}\n", "splice-expression"); accept(ast->splicer, "splicer"); } void ASTPrinter::visit(GlobalScopeReflectExpressionAST* ast) { - out_ << cxx::format("{}\n", "global-scope-reflect-expression"); + out_ << std::format("{}\n", "global-scope-reflect-expression"); } void ASTPrinter::visit(NamespaceReflectExpressionAST* ast) { - out_ << cxx::format("{}\n", "namespace-reflect-expression"); + out_ << std::format("{}\n", "namespace-reflect-expression"); accept(ast->identifier, "identifier"); } void ASTPrinter::visit(TypeIdReflectExpressionAST* ast) { - out_ << cxx::format("{}\n", "type-id-reflect-expression"); + out_ << std::format("{}\n", "type-id-reflect-expression"); accept(ast->typeId, "type-id"); } void ASTPrinter::visit(ReflectExpressionAST* ast) { - out_ << cxx::format("{}\n", "reflect-expression"); + out_ << std::format("{}\n", "reflect-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(UnaryExpressionAST* ast) { - out_ << cxx::format("{}\n", "unary-expression"); + out_ << std::format("{}\n", "unary-expression"); if (ast->op != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("op: {}\n", Token::spell(ast->op)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("op: {}\n", Token::spell(ast->op)); --indent_; } accept(ast->expression, "expression"); } void ASTPrinter::visit(AwaitExpressionAST* ast) { - out_ << cxx::format("{}\n", "await-expression"); + out_ << std::format("{}\n", "await-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(SizeofExpressionAST* ast) { - out_ << cxx::format("{}\n", "sizeof-expression"); + out_ << std::format("{}\n", "sizeof-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(SizeofTypeExpressionAST* ast) { - out_ << cxx::format("{}\n", "sizeof-type-expression"); + out_ << std::format("{}\n", "sizeof-type-expression"); accept(ast->typeId, "type-id"); } void ASTPrinter::visit(SizeofPackExpressionAST* ast) { - out_ << cxx::format("{}\n", "sizeof-pack-expression"); + out_ << std::format("{}\n", "sizeof-pack-expression"); accept(ast->identifier, "identifier"); } void ASTPrinter::visit(AlignofTypeExpressionAST* ast) { - out_ << cxx::format("{}\n", "alignof-type-expression"); + out_ << std::format("{}\n", "alignof-type-expression"); accept(ast->typeId, "type-id"); } void ASTPrinter::visit(AlignofExpressionAST* ast) { - out_ << cxx::format("{}\n", "alignof-expression"); + out_ << std::format("{}\n", "alignof-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(NoexceptExpressionAST* ast) { - out_ << cxx::format("{}\n", "noexcept-expression"); + out_ << std::format("{}\n", "noexcept-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(NewExpressionAST* ast) { - out_ << cxx::format("{}\n", "new-expression"); + out_ << std::format("{}\n", "new-expression"); accept(ast->newPlacement, "new-placement"); if (ast->typeSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "type-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "type-specifier-list"); for (auto it = ast->typeSpecifierList; it; it = it->next) { accept(it->value); } @@ -1122,31 +1122,31 @@ void ASTPrinter::visit(NewExpressionAST* ast) { } void ASTPrinter::visit(DeleteExpressionAST* ast) { - out_ << cxx::format("{}\n", "delete-expression"); + out_ << std::format("{}\n", "delete-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(CastExpressionAST* ast) { - out_ << cxx::format("{}\n", "cast-expression"); + out_ << std::format("{}\n", "cast-expression"); accept(ast->typeId, "type-id"); accept(ast->expression, "expression"); } void ASTPrinter::visit(ImplicitCastExpressionAST* ast) { - out_ << cxx::format("{}\n", "implicit-cast-expression"); + out_ << std::format("{}\n", "implicit-cast-expression"); ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("cast-kind: {}\n", to_string(ast->castKind)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("cast-kind: {}\n", to_string(ast->castKind)); --indent_; accept(ast->expression, "expression"); } void ASTPrinter::visit(BinaryExpressionAST* ast) { - out_ << cxx::format("{}\n", "binary-expression"); + out_ << std::format("{}\n", "binary-expression"); if (ast->op != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("op: {}\n", Token::spell(ast->op)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("op: {}\n", Token::spell(ast->op)); --indent_; } accept(ast->leftExpression, "left-expression"); @@ -1154,28 +1154,28 @@ void ASTPrinter::visit(BinaryExpressionAST* ast) { } void ASTPrinter::visit(ConditionalExpressionAST* ast) { - out_ << cxx::format("{}\n", "conditional-expression"); + out_ << std::format("{}\n", "conditional-expression"); accept(ast->condition, "condition"); accept(ast->iftrueExpression, "iftrue-expression"); accept(ast->iffalseExpression, "iffalse-expression"); } void ASTPrinter::visit(YieldExpressionAST* ast) { - out_ << cxx::format("{}\n", "yield-expression"); + out_ << std::format("{}\n", "yield-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(ThrowExpressionAST* ast) { - out_ << cxx::format("{}\n", "throw-expression"); + out_ << std::format("{}\n", "throw-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(AssignmentExpressionAST* ast) { - out_ << cxx::format("{}\n", "assignment-expression"); + out_ << std::format("{}\n", "assignment-expression"); if (ast->op != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("op: {}\n", Token::spell(ast->op)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("op: {}\n", Token::spell(ast->op)); --indent_; } accept(ast->leftExpression, "left-expression"); @@ -1183,22 +1183,22 @@ void ASTPrinter::visit(AssignmentExpressionAST* ast) { } void ASTPrinter::visit(PackExpansionExpressionAST* ast) { - out_ << cxx::format("{}\n", "pack-expansion-expression"); + out_ << std::format("{}\n", "pack-expansion-expression"); accept(ast->expression, "expression"); } void ASTPrinter::visit(DesignatedInitializerClauseAST* ast) { - out_ << cxx::format("{}\n", "designated-initializer-clause"); + out_ << std::format("{}\n", "designated-initializer-clause"); accept(ast->identifier, "identifier"); accept(ast->initializer, "initializer"); } void ASTPrinter::visit(TypeTraitExpressionAST* ast) { - out_ << cxx::format("{}\n", "type-trait-expression"); + out_ << std::format("{}\n", "type-trait-expression"); if (ast->typeIdList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "type-id-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "type-id-list"); for (auto it = ast->typeIdList; it; it = it->next) { accept(it->value); } @@ -1207,11 +1207,11 @@ void ASTPrinter::visit(TypeTraitExpressionAST* ast) { } void ASTPrinter::visit(ConditionExpressionAST* ast) { - out_ << cxx::format("{}\n", "condition-expression"); + out_ << std::format("{}\n", "condition-expression"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1219,8 +1219,8 @@ void ASTPrinter::visit(ConditionExpressionAST* ast) { } if (ast->declSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "decl-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "decl-specifier-list"); for (auto it = ast->declSpecifierList; it; it = it->next) { accept(it->value); } @@ -1231,16 +1231,16 @@ void ASTPrinter::visit(ConditionExpressionAST* ast) { } void ASTPrinter::visit(EqualInitializerAST* ast) { - out_ << cxx::format("{}\n", "equal-initializer"); + out_ << std::format("{}\n", "equal-initializer"); accept(ast->expression, "expression"); } void ASTPrinter::visit(BracedInitListAST* ast) { - out_ << cxx::format("{}\n", "braced-init-list"); + out_ << std::format("{}\n", "braced-init-list"); if (ast->expressionList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "expression-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "expression-list"); for (auto it = ast->expressionList; it; it = it->next) { accept(it->value); } @@ -1249,11 +1249,11 @@ void ASTPrinter::visit(BracedInitListAST* ast) { } void ASTPrinter::visit(ParenInitializerAST* ast) { - out_ << cxx::format("{}\n", "paren-initializer"); + out_ << std::format("{}\n", "paren-initializer"); if (ast->expressionList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "expression-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "expression-list"); for (auto it = ast->expressionList; it; it = it->next) { accept(it->value); } @@ -1262,16 +1262,16 @@ void ASTPrinter::visit(ParenInitializerAST* ast) { } void ASTPrinter::visit(SplicerAST* ast) { - out_ << cxx::format("{}\n", "splicer"); + out_ << std::format("{}\n", "splicer"); accept(ast->expression, "expression"); } void ASTPrinter::visit(GlobalModuleFragmentAST* ast) { - out_ << cxx::format("{}\n", "global-module-fragment"); + out_ << std::format("{}\n", "global-module-fragment"); if (ast->declarationList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "declaration-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declaration-list"); for (auto it = ast->declarationList; it; it = it->next) { accept(it->value); } @@ -1280,11 +1280,11 @@ void ASTPrinter::visit(GlobalModuleFragmentAST* ast) { } void ASTPrinter::visit(PrivateModuleFragmentAST* ast) { - out_ << cxx::format("{}\n", "private-module-fragment"); + out_ << std::format("{}\n", "private-module-fragment"); if (ast->declarationList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "declaration-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declaration-list"); for (auto it = ast->declarationList; it; it = it->next) { accept(it->value); } @@ -1293,13 +1293,13 @@ void ASTPrinter::visit(PrivateModuleFragmentAST* ast) { } void ASTPrinter::visit(ModuleDeclarationAST* ast) { - out_ << cxx::format("{}\n", "module-declaration"); + out_ << std::format("{}\n", "module-declaration"); accept(ast->moduleName, "module-name"); accept(ast->modulePartition, "module-partition"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1308,41 +1308,41 @@ void ASTPrinter::visit(ModuleDeclarationAST* ast) { } void ASTPrinter::visit(ModuleNameAST* ast) { - out_ << cxx::format("{}\n", "module-name"); + out_ << std::format("{}\n", "module-name"); accept(ast->identifier, "identifier"); accept(ast->moduleQualifier, "module-qualifier"); } void ASTPrinter::visit(ModuleQualifierAST* ast) { - out_ << cxx::format("{}\n", "module-qualifier"); + out_ << std::format("{}\n", "module-qualifier"); accept(ast->identifier, "identifier"); accept(ast->moduleQualifier, "module-qualifier"); } void ASTPrinter::visit(ModulePartitionAST* ast) { - out_ << cxx::format("{}\n", "module-partition"); + out_ << std::format("{}\n", "module-partition"); accept(ast->moduleName, "module-name"); } void ASTPrinter::visit(ImportNameAST* ast) { - out_ << cxx::format("{}\n", "import-name"); + out_ << std::format("{}\n", "import-name"); accept(ast->modulePartition, "module-partition"); accept(ast->moduleName, "module-name"); } void ASTPrinter::visit(InitDeclaratorAST* ast) { - out_ << cxx::format("{}\n", "init-declarator"); + out_ << std::format("{}\n", "init-declarator"); accept(ast->declarator, "declarator"); accept(ast->requiresClause, "requires-clause"); accept(ast->initializer, "initializer"); } void ASTPrinter::visit(DeclaratorAST* ast) { - out_ << cxx::format("{}\n", "declarator"); + out_ << std::format("{}\n", "declarator"); if (ast->ptrOpList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "ptr-op-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "ptr-op-list"); for (auto it = ast->ptrOpList; it; it = it->next) { accept(it->value); } @@ -1351,8 +1351,8 @@ void ASTPrinter::visit(DeclaratorAST* ast) { accept(ast->coreDeclarator, "core-declarator"); if (ast->declaratorChunkList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "declarator-chunk-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declarator-chunk-list"); for (auto it = ast->declaratorChunkList; it; it = it->next) { accept(it->value); } @@ -1361,11 +1361,11 @@ void ASTPrinter::visit(DeclaratorAST* ast) { } void ASTPrinter::visit(UsingDeclaratorAST* ast) { - out_ << cxx::format("{}\n", "using-declarator"); + out_ << std::format("{}\n", "using-declarator"); if (ast->isPack) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-pack: {}\n", ast->isPack); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-pack: {}\n", ast->isPack); --indent_; } accept(ast->nestedNameSpecifier, "nested-name-specifier"); @@ -1373,12 +1373,12 @@ void ASTPrinter::visit(UsingDeclaratorAST* ast) { } void ASTPrinter::visit(EnumeratorAST* ast) { - out_ << cxx::format("{}\n", "enumerator"); + out_ << std::format("{}\n", "enumerator"); accept(ast->identifier, "identifier"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1388,11 +1388,11 @@ void ASTPrinter::visit(EnumeratorAST* ast) { } void ASTPrinter::visit(TypeIdAST* ast) { - out_ << cxx::format("{}\n", "type-id"); + out_ << std::format("{}\n", "type-id"); if (ast->typeSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "type-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "type-specifier-list"); for (auto it = ast->typeSpecifierList; it; it = it->next) { accept(it->value); } @@ -1402,37 +1402,37 @@ void ASTPrinter::visit(TypeIdAST* ast) { } void ASTPrinter::visit(HandlerAST* ast) { - out_ << cxx::format("{}\n", "handler"); + out_ << std::format("{}\n", "handler"); accept(ast->exceptionDeclaration, "exception-declaration"); accept(ast->statement, "statement"); } void ASTPrinter::visit(BaseSpecifierAST* ast) { - out_ << cxx::format("{}\n", "base-specifier"); + out_ << std::format("{}\n", "base-specifier"); if (ast->isTemplateIntroduced) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-template-introduced: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-template-introduced: {}\n", ast->isTemplateIntroduced); --indent_; } if (ast->isVirtual) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-virtual: {}\n", ast->isVirtual); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-virtual: {}\n", ast->isVirtual); --indent_; } if (ast->accessSpecifier != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("access-specifier: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("access-specifier: {}\n", Token::spell(ast->accessSpecifier)); --indent_; } if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1443,22 +1443,22 @@ void ASTPrinter::visit(BaseSpecifierAST* ast) { } void ASTPrinter::visit(RequiresClauseAST* ast) { - out_ << cxx::format("{}\n", "requires-clause"); + out_ << std::format("{}\n", "requires-clause"); accept(ast->expression, "expression"); } void ASTPrinter::visit(ParameterDeclarationClauseAST* ast) { - out_ << cxx::format("{}\n", "parameter-declaration-clause"); + out_ << std::format("{}\n", "parameter-declaration-clause"); if (ast->isVariadic) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-variadic: {}\n", ast->isVariadic); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-variadic: {}\n", ast->isVariadic); --indent_; } if (ast->parameterDeclarationList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "parameter-declaration-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "parameter-declaration-list"); for (auto it = ast->parameterDeclarationList; it; it = it->next) { accept(it->value); } @@ -1467,28 +1467,28 @@ void ASTPrinter::visit(ParameterDeclarationClauseAST* ast) { } void ASTPrinter::visit(TrailingReturnTypeAST* ast) { - out_ << cxx::format("{}\n", "trailing-return-type"); + out_ << std::format("{}\n", "trailing-return-type"); accept(ast->typeId, "type-id"); } void ASTPrinter::visit(LambdaSpecifierAST* ast) { - out_ << cxx::format("{}\n", "lambda-specifier"); + out_ << std::format("{}\n", "lambda-specifier"); if (ast->specifier != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("specifier: {}\n", Token::spell(ast->specifier)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("specifier: {}\n", Token::spell(ast->specifier)); --indent_; } } void ASTPrinter::visit(TypeConstraintAST* ast) { - out_ << cxx::format("{}\n", "type-constraint"); + out_ << std::format("{}\n", "type-constraint"); accept(ast->identifier, "identifier"); accept(ast->nestedNameSpecifier, "nested-name-specifier"); if (ast->templateArgumentList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "template-argument-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "template-argument-list"); for (auto it = ast->templateArgumentList; it; it = it->next) { accept(it->value); } @@ -1497,25 +1497,25 @@ void ASTPrinter::visit(TypeConstraintAST* ast) { } void ASTPrinter::visit(AttributeArgumentClauseAST* ast) { - out_ << cxx::format("{}\n", "attribute-argument-clause"); + out_ << std::format("{}\n", "attribute-argument-clause"); } void ASTPrinter::visit(AttributeAST* ast) { - out_ << cxx::format("{}\n", "attribute"); + out_ << std::format("{}\n", "attribute"); accept(ast->attributeToken, "attribute-token"); accept(ast->attributeArgumentClause, "attribute-argument-clause"); } void ASTPrinter::visit(AttributeUsingPrefixAST* ast) { - out_ << cxx::format("{}\n", "attribute-using-prefix"); + out_ << std::format("{}\n", "attribute-using-prefix"); } void ASTPrinter::visit(NewPlacementAST* ast) { - out_ << cxx::format("{}\n", "new-placement"); + out_ << std::format("{}\n", "new-placement"); if (ast->expressionList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "expression-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "expression-list"); for (auto it = ast->expressionList; it; it = it->next) { accept(it->value); } @@ -1524,37 +1524,37 @@ void ASTPrinter::visit(NewPlacementAST* ast) { } void ASTPrinter::visit(NestedNamespaceSpecifierAST* ast) { - out_ << cxx::format("{}\n", "nested-namespace-specifier"); + out_ << std::format("{}\n", "nested-namespace-specifier"); accept(ast->identifier, "identifier"); if (ast->isInline) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-inline: {}\n", ast->isInline); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-inline: {}\n", ast->isInline); --indent_; } } void ASTPrinter::visit(TemplateTypeParameterAST* ast) { - out_ << cxx::format("{}\n", "template-type-parameter"); + out_ << std::format("{}\n", "template-type-parameter"); ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("depth: {}\n", ast->depth); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("depth: {}\n", ast->depth); --indent_; ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("index: {}\n", ast->index); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("index: {}\n", ast->index); --indent_; accept(ast->identifier, "identifier"); if (ast->isPack) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-pack: {}\n", ast->isPack); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-pack: {}\n", ast->isPack); --indent_; } if (ast->templateParameterList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "template-parameter-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "template-parameter-list"); for (auto it = ast->templateParameterList; it; it = it->next) { accept(it->value); } @@ -1565,47 +1565,47 @@ void ASTPrinter::visit(TemplateTypeParameterAST* ast) { } void ASTPrinter::visit(NonTypeTemplateParameterAST* ast) { - out_ << cxx::format("{}\n", "non-type-template-parameter"); + out_ << std::format("{}\n", "non-type-template-parameter"); ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("depth: {}\n", ast->depth); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("depth: {}\n", ast->depth); --indent_; ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("index: {}\n", ast->index); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("index: {}\n", ast->index); --indent_; accept(ast->declaration, "declaration"); } void ASTPrinter::visit(TypenameTypeParameterAST* ast) { - out_ << cxx::format("{}\n", "typename-type-parameter"); + out_ << std::format("{}\n", "typename-type-parameter"); ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("depth: {}\n", ast->depth); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("depth: {}\n", ast->depth); --indent_; ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("index: {}\n", ast->index); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("index: {}\n", ast->index); --indent_; accept(ast->identifier, "identifier"); if (ast->isPack) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-pack: {}\n", ast->isPack); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-pack: {}\n", ast->isPack); --indent_; } accept(ast->typeId, "type-id"); } void ASTPrinter::visit(ConstraintTypeParameterAST* ast) { - out_ << cxx::format("{}\n", "constraint-type-parameter"); + out_ << std::format("{}\n", "constraint-type-parameter"); ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("depth: {}\n", ast->depth); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("depth: {}\n", ast->depth); --indent_; ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("index: {}\n", ast->index); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("index: {}\n", ast->index); --indent_; accept(ast->identifier, "identifier"); accept(ast->typeConstraint, "type-constraint"); @@ -1613,130 +1613,130 @@ void ASTPrinter::visit(ConstraintTypeParameterAST* ast) { } void ASTPrinter::visit(GeneratedTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "generated-type-specifier"); + out_ << std::format("{}\n", "generated-type-specifier"); } void ASTPrinter::visit(TypedefSpecifierAST* ast) { - out_ << cxx::format("{}\n", "typedef-specifier"); + out_ << std::format("{}\n", "typedef-specifier"); } void ASTPrinter::visit(FriendSpecifierAST* ast) { - out_ << cxx::format("{}\n", "friend-specifier"); + out_ << std::format("{}\n", "friend-specifier"); } void ASTPrinter::visit(ConstevalSpecifierAST* ast) { - out_ << cxx::format("{}\n", "consteval-specifier"); + out_ << std::format("{}\n", "consteval-specifier"); } void ASTPrinter::visit(ConstinitSpecifierAST* ast) { - out_ << cxx::format("{}\n", "constinit-specifier"); + out_ << std::format("{}\n", "constinit-specifier"); } void ASTPrinter::visit(ConstexprSpecifierAST* ast) { - out_ << cxx::format("{}\n", "constexpr-specifier"); + out_ << std::format("{}\n", "constexpr-specifier"); } void ASTPrinter::visit(InlineSpecifierAST* ast) { - out_ << cxx::format("{}\n", "inline-specifier"); + out_ << std::format("{}\n", "inline-specifier"); } void ASTPrinter::visit(StaticSpecifierAST* ast) { - out_ << cxx::format("{}\n", "static-specifier"); + out_ << std::format("{}\n", "static-specifier"); } void ASTPrinter::visit(ExternSpecifierAST* ast) { - out_ << cxx::format("{}\n", "extern-specifier"); + out_ << std::format("{}\n", "extern-specifier"); } void ASTPrinter::visit(ThreadLocalSpecifierAST* ast) { - out_ << cxx::format("{}\n", "thread-local-specifier"); + out_ << std::format("{}\n", "thread-local-specifier"); } void ASTPrinter::visit(ThreadSpecifierAST* ast) { - out_ << cxx::format("{}\n", "thread-specifier"); + out_ << std::format("{}\n", "thread-specifier"); } void ASTPrinter::visit(MutableSpecifierAST* ast) { - out_ << cxx::format("{}\n", "mutable-specifier"); + out_ << std::format("{}\n", "mutable-specifier"); } void ASTPrinter::visit(VirtualSpecifierAST* ast) { - out_ << cxx::format("{}\n", "virtual-specifier"); + out_ << std::format("{}\n", "virtual-specifier"); } void ASTPrinter::visit(ExplicitSpecifierAST* ast) { - out_ << cxx::format("{}\n", "explicit-specifier"); + out_ << std::format("{}\n", "explicit-specifier"); accept(ast->expression, "expression"); } void ASTPrinter::visit(AutoTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "auto-type-specifier"); + out_ << std::format("{}\n", "auto-type-specifier"); } void ASTPrinter::visit(VoidTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "void-type-specifier"); + out_ << std::format("{}\n", "void-type-specifier"); } void ASTPrinter::visit(SizeTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "size-type-specifier"); + out_ << std::format("{}\n", "size-type-specifier"); if (ast->specifier != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("specifier: {}\n", Token::spell(ast->specifier)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("specifier: {}\n", Token::spell(ast->specifier)); --indent_; } } void ASTPrinter::visit(SignTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "sign-type-specifier"); + out_ << std::format("{}\n", "sign-type-specifier"); if (ast->specifier != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("specifier: {}\n", Token::spell(ast->specifier)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("specifier: {}\n", Token::spell(ast->specifier)); --indent_; } } void ASTPrinter::visit(VaListTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "va-list-type-specifier"); + out_ << std::format("{}\n", "va-list-type-specifier"); if (ast->specifier != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("specifier: {}\n", Token::spell(ast->specifier)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("specifier: {}\n", Token::spell(ast->specifier)); --indent_; } } void ASTPrinter::visit(IntegralTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "integral-type-specifier"); + out_ << std::format("{}\n", "integral-type-specifier"); if (ast->specifier != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("specifier: {}\n", Token::spell(ast->specifier)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("specifier: {}\n", Token::spell(ast->specifier)); --indent_; } } void ASTPrinter::visit(FloatingPointTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "floating-point-type-specifier"); + out_ << std::format("{}\n", "floating-point-type-specifier"); if (ast->specifier != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("specifier: {}\n", Token::spell(ast->specifier)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("specifier: {}\n", Token::spell(ast->specifier)); --indent_; } } void ASTPrinter::visit(ComplexTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "complex-type-specifier"); + out_ << std::format("{}\n", "complex-type-specifier"); } void ASTPrinter::visit(NamedTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "named-type-specifier"); + out_ << std::format("{}\n", "named-type-specifier"); if (ast->isTemplateIntroduced) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-template-introduced: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-template-introduced: {}\n", ast->isTemplateIntroduced); --indent_; } @@ -1745,34 +1745,34 @@ void ASTPrinter::visit(NamedTypeSpecifierAST* ast) { } void ASTPrinter::visit(AtomicTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "atomic-type-specifier"); + out_ << std::format("{}\n", "atomic-type-specifier"); accept(ast->typeId, "type-id"); } void ASTPrinter::visit(UnderlyingTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "underlying-type-specifier"); + out_ << std::format("{}\n", "underlying-type-specifier"); accept(ast->typeId, "type-id"); } void ASTPrinter::visit(ElaboratedTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "elaborated-type-specifier"); + out_ << std::format("{}\n", "elaborated-type-specifier"); if (ast->classKey != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("class-key: {}\n", Token::spell(ast->classKey)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("class-key: {}\n", Token::spell(ast->classKey)); --indent_; } if (ast->isTemplateIntroduced) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-template-introduced: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-template-introduced: {}\n", ast->isTemplateIntroduced); --indent_; } if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1783,38 +1783,38 @@ void ASTPrinter::visit(ElaboratedTypeSpecifierAST* ast) { } void ASTPrinter::visit(DecltypeAutoSpecifierAST* ast) { - out_ << cxx::format("{}\n", "decltype-auto-specifier"); + out_ << std::format("{}\n", "decltype-auto-specifier"); } void ASTPrinter::visit(DecltypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "decltype-specifier"); + out_ << std::format("{}\n", "decltype-specifier"); accept(ast->expression, "expression"); } void ASTPrinter::visit(PlaceholderTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "placeholder-type-specifier"); + out_ << std::format("{}\n", "placeholder-type-specifier"); accept(ast->typeConstraint, "type-constraint"); accept(ast->specifier, "specifier"); } void ASTPrinter::visit(ConstQualifierAST* ast) { - out_ << cxx::format("{}\n", "const-qualifier"); + out_ << std::format("{}\n", "const-qualifier"); } void ASTPrinter::visit(VolatileQualifierAST* ast) { - out_ << cxx::format("{}\n", "volatile-qualifier"); + out_ << std::format("{}\n", "volatile-qualifier"); } void ASTPrinter::visit(RestrictQualifierAST* ast) { - out_ << cxx::format("{}\n", "restrict-qualifier"); + out_ << std::format("{}\n", "restrict-qualifier"); } void ASTPrinter::visit(EnumSpecifierAST* ast) { - out_ << cxx::format("{}\n", "enum-specifier"); + out_ << std::format("{}\n", "enum-specifier"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1824,8 +1824,8 @@ void ASTPrinter::visit(EnumSpecifierAST* ast) { accept(ast->unqualifiedId, "unqualified-id"); if (ast->typeSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "type-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "type-specifier-list"); for (auto it = ast->typeSpecifierList; it; it = it->next) { accept(it->value); } @@ -1833,8 +1833,8 @@ void ASTPrinter::visit(EnumSpecifierAST* ast) { } if (ast->enumeratorList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "enumerator-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "enumerator-list"); for (auto it = ast->enumeratorList; it; it = it->next) { accept(it->value); } @@ -1843,23 +1843,23 @@ void ASTPrinter::visit(EnumSpecifierAST* ast) { } void ASTPrinter::visit(ClassSpecifierAST* ast) { - out_ << cxx::format("{}\n", "class-specifier"); + out_ << std::format("{}\n", "class-specifier"); if (ast->classKey != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("class-key: {}\n", Token::spell(ast->classKey)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("class-key: {}\n", Token::spell(ast->classKey)); --indent_; } if (ast->isFinal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-final: {}\n", ast->isFinal); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-final: {}\n", ast->isFinal); --indent_; } if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1869,8 +1869,8 @@ void ASTPrinter::visit(ClassSpecifierAST* ast) { accept(ast->unqualifiedId, "unqualified-id"); if (ast->baseSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "base-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "base-specifier-list"); for (auto it = ast->baseSpecifierList; it; it = it->next) { accept(it->value); } @@ -1878,8 +1878,8 @@ void ASTPrinter::visit(ClassSpecifierAST* ast) { } if (ast->declarationList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "declaration-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declaration-list"); for (auto it = ast->declarationList; it; it = it->next) { accept(it->value); } @@ -1888,22 +1888,22 @@ void ASTPrinter::visit(ClassSpecifierAST* ast) { } void ASTPrinter::visit(TypenameSpecifierAST* ast) { - out_ << cxx::format("{}\n", "typename-specifier"); + out_ << std::format("{}\n", "typename-specifier"); accept(ast->nestedNameSpecifier, "nested-name-specifier"); accept(ast->unqualifiedId, "unqualified-id"); } void ASTPrinter::visit(SplicerTypeSpecifierAST* ast) { - out_ << cxx::format("{}\n", "splicer-type-specifier"); + out_ << std::format("{}\n", "splicer-type-specifier"); accept(ast->splicer, "splicer"); } void ASTPrinter::visit(PointerOperatorAST* ast) { - out_ << cxx::format("{}\n", "pointer-operator"); + out_ << std::format("{}\n", "pointer-operator"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1911,8 +1911,8 @@ void ASTPrinter::visit(PointerOperatorAST* ast) { } if (ast->cvQualifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "cv-qualifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "cv-qualifier-list"); for (auto it = ast->cvQualifierList; it; it = it->next) { accept(it->value); } @@ -1921,17 +1921,17 @@ void ASTPrinter::visit(PointerOperatorAST* ast) { } void ASTPrinter::visit(ReferenceOperatorAST* ast) { - out_ << cxx::format("{}\n", "reference-operator"); + out_ << std::format("{}\n", "reference-operator"); if (ast->refOp != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("ref-op: {}\n", Token::spell(ast->refOp)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("ref-op: {}\n", Token::spell(ast->refOp)); --indent_; } if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1940,12 +1940,12 @@ void ASTPrinter::visit(ReferenceOperatorAST* ast) { } void ASTPrinter::visit(PtrToMemberOperatorAST* ast) { - out_ << cxx::format("{}\n", "ptr-to-member-operator"); + out_ << std::format("{}\n", "ptr-to-member-operator"); accept(ast->nestedNameSpecifier, "nested-name-specifier"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1953,8 +1953,8 @@ void ASTPrinter::visit(PtrToMemberOperatorAST* ast) { } if (ast->cvQualifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "cv-qualifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "cv-qualifier-list"); for (auto it = ast->cvQualifierList; it; it = it->next) { accept(it->value); } @@ -1963,22 +1963,22 @@ void ASTPrinter::visit(PtrToMemberOperatorAST* ast) { } void ASTPrinter::visit(BitfieldDeclaratorAST* ast) { - out_ << cxx::format("{}\n", "bitfield-declarator"); + out_ << std::format("{}\n", "bitfield-declarator"); accept(ast->unqualifiedId, "unqualified-id"); accept(ast->sizeExpression, "size-expression"); } void ASTPrinter::visit(ParameterPackAST* ast) { - out_ << cxx::format("{}\n", "parameter-pack"); + out_ << std::format("{}\n", "parameter-pack"); accept(ast->coreDeclarator, "core-declarator"); } void ASTPrinter::visit(IdDeclaratorAST* ast) { - out_ << cxx::format("{}\n", "id-declarator"); + out_ << std::format("{}\n", "id-declarator"); if (ast->isTemplateIntroduced) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-template-introduced: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-template-introduced: {}\n", ast->isTemplateIntroduced); --indent_; } @@ -1986,8 +1986,8 @@ void ASTPrinter::visit(IdDeclaratorAST* ast) { accept(ast->unqualifiedId, "unqualified-id"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -1996,35 +1996,35 @@ void ASTPrinter::visit(IdDeclaratorAST* ast) { } void ASTPrinter::visit(NestedDeclaratorAST* ast) { - out_ << cxx::format("{}\n", "nested-declarator"); + out_ << std::format("{}\n", "nested-declarator"); accept(ast->declarator, "declarator"); } void ASTPrinter::visit(FunctionDeclaratorChunkAST* ast) { - out_ << cxx::format("{}\n", "function-declarator-chunk"); + out_ << std::format("{}\n", "function-declarator-chunk"); if (ast->isFinal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-final: {}\n", ast->isFinal); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-final: {}\n", ast->isFinal); --indent_; } if (ast->isOverride) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-override: {}\n", ast->isOverride); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-override: {}\n", ast->isOverride); --indent_; } if (ast->isPure) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-pure: {}\n", ast->isPure); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-pure: {}\n", ast->isPure); --indent_; } accept(ast->parameterDeclarationClause, "parameter-declaration-clause"); if (ast->cvQualifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "cv-qualifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "cv-qualifier-list"); for (auto it = ast->cvQualifierList; it; it = it->next) { accept(it->value); } @@ -2033,8 +2033,8 @@ void ASTPrinter::visit(FunctionDeclaratorChunkAST* ast) { accept(ast->exceptionSpecifier, "exception-specifier"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -2044,12 +2044,12 @@ void ASTPrinter::visit(FunctionDeclaratorChunkAST* ast) { } void ASTPrinter::visit(ArrayDeclaratorChunkAST* ast) { - out_ << cxx::format("{}\n", "array-declarator-chunk"); + out_ << std::format("{}\n", "array-declarator-chunk"); accept(ast->expression, "expression"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -2058,53 +2058,53 @@ void ASTPrinter::visit(ArrayDeclaratorChunkAST* ast) { } void ASTPrinter::visit(NameIdAST* ast) { - out_ << cxx::format("{}\n", "name-id"); + out_ << std::format("{}\n", "name-id"); accept(ast->identifier, "identifier"); } void ASTPrinter::visit(DestructorIdAST* ast) { - out_ << cxx::format("{}\n", "destructor-id"); + out_ << std::format("{}\n", "destructor-id"); accept(ast->id, "id"); } void ASTPrinter::visit(DecltypeIdAST* ast) { - out_ << cxx::format("{}\n", "decltype-id"); + out_ << std::format("{}\n", "decltype-id"); accept(ast->decltypeSpecifier, "decltype-specifier"); } void ASTPrinter::visit(OperatorFunctionIdAST* ast) { - out_ << cxx::format("{}\n", "operator-function-id"); + out_ << std::format("{}\n", "operator-function-id"); if (ast->op != TokenKind::T_EOF_SYMBOL) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("op: {}\n", Token::spell(ast->op)); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("op: {}\n", Token::spell(ast->op)); --indent_; } } void ASTPrinter::visit(LiteralOperatorIdAST* ast) { - out_ << cxx::format("{}\n", "literal-operator-id"); + out_ << std::format("{}\n", "literal-operator-id"); if (ast->literal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", ast->literal->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", ast->literal->value()); --indent_; } accept(ast->identifier, "identifier"); } void ASTPrinter::visit(ConversionFunctionIdAST* ast) { - out_ << cxx::format("{}\n", "conversion-function-id"); + out_ << std::format("{}\n", "conversion-function-id"); accept(ast->typeId, "type-id"); } void ASTPrinter::visit(SimpleTemplateIdAST* ast) { - out_ << cxx::format("{}\n", "simple-template-id"); + out_ << std::format("{}\n", "simple-template-id"); accept(ast->identifier, "identifier"); if (ast->templateArgumentList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "template-argument-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "template-argument-list"); for (auto it = ast->templateArgumentList; it; it = it->next) { accept(it->value); } @@ -2113,12 +2113,12 @@ void ASTPrinter::visit(SimpleTemplateIdAST* ast) { } void ASTPrinter::visit(LiteralOperatorTemplateIdAST* ast) { - out_ << cxx::format("{}\n", "literal-operator-template-id"); + out_ << std::format("{}\n", "literal-operator-template-id"); accept(ast->literalOperatorId, "literal-operator-id"); if (ast->templateArgumentList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "template-argument-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "template-argument-list"); for (auto it = ast->templateArgumentList; it; it = it->next) { accept(it->value); } @@ -2127,12 +2127,12 @@ void ASTPrinter::visit(LiteralOperatorTemplateIdAST* ast) { } void ASTPrinter::visit(OperatorFunctionTemplateIdAST* ast) { - out_ << cxx::format("{}\n", "operator-function-template-id"); + out_ << std::format("{}\n", "operator-function-template-id"); accept(ast->operatorFunctionId, "operator-function-id"); if (ast->templateArgumentList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "template-argument-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "template-argument-list"); for (auto it = ast->templateArgumentList; it; it = it->next) { accept(it->value); } @@ -2141,27 +2141,27 @@ void ASTPrinter::visit(OperatorFunctionTemplateIdAST* ast) { } void ASTPrinter::visit(GlobalNestedNameSpecifierAST* ast) { - out_ << cxx::format("{}\n", "global-nested-name-specifier"); + out_ << std::format("{}\n", "global-nested-name-specifier"); } void ASTPrinter::visit(SimpleNestedNameSpecifierAST* ast) { - out_ << cxx::format("{}\n", "simple-nested-name-specifier"); + out_ << std::format("{}\n", "simple-nested-name-specifier"); accept(ast->identifier, "identifier"); accept(ast->nestedNameSpecifier, "nested-name-specifier"); } void ASTPrinter::visit(DecltypeNestedNameSpecifierAST* ast) { - out_ << cxx::format("{}\n", "decltype-nested-name-specifier"); + out_ << std::format("{}\n", "decltype-nested-name-specifier"); accept(ast->nestedNameSpecifier, "nested-name-specifier"); accept(ast->decltypeSpecifier, "decltype-specifier"); } void ASTPrinter::visit(TemplateNestedNameSpecifierAST* ast) { - out_ << cxx::format("{}\n", "template-nested-name-specifier"); + out_ << std::format("{}\n", "template-nested-name-specifier"); if (ast->isTemplateIntroduced) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-template-introduced: {}\n", + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-template-introduced: {}\n", ast->isTemplateIntroduced); --indent_; } @@ -2170,15 +2170,15 @@ void ASTPrinter::visit(TemplateNestedNameSpecifierAST* ast) { } void ASTPrinter::visit(DefaultFunctionBodyAST* ast) { - out_ << cxx::format("{}\n", "default-function-body"); + out_ << std::format("{}\n", "default-function-body"); } void ASTPrinter::visit(CompoundStatementFunctionBodyAST* ast) { - out_ << cxx::format("{}\n", "compound-statement-function-body"); + out_ << std::format("{}\n", "compound-statement-function-body"); if (ast->memInitializerList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "mem-initializer-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "mem-initializer-list"); for (auto it = ast->memInitializerList; it; it = it->next) { accept(it->value); } @@ -2188,11 +2188,11 @@ void ASTPrinter::visit(CompoundStatementFunctionBodyAST* ast) { } void ASTPrinter::visit(TryStatementFunctionBodyAST* ast) { - out_ << cxx::format("{}\n", "try-statement-function-body"); + out_ << std::format("{}\n", "try-statement-function-body"); if (ast->memInitializerList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "mem-initializer-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "mem-initializer-list"); for (auto it = ast->memInitializerList; it; it = it->next) { accept(it->value); } @@ -2201,8 +2201,8 @@ void ASTPrinter::visit(TryStatementFunctionBodyAST* ast) { accept(ast->statement, "statement"); if (ast->handlerList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "handler-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "handler-list"); for (auto it = ast->handlerList; it; it = it->next) { accept(it->value); } @@ -2211,56 +2211,56 @@ void ASTPrinter::visit(TryStatementFunctionBodyAST* ast) { } void ASTPrinter::visit(DeleteFunctionBodyAST* ast) { - out_ << cxx::format("{}\n", "delete-function-body"); + out_ << std::format("{}\n", "delete-function-body"); } void ASTPrinter::visit(TypeTemplateArgumentAST* ast) { - out_ << cxx::format("{}\n", "type-template-argument"); + out_ << std::format("{}\n", "type-template-argument"); accept(ast->typeId, "type-id"); } void ASTPrinter::visit(ExpressionTemplateArgumentAST* ast) { - out_ << cxx::format("{}\n", "expression-template-argument"); + out_ << std::format("{}\n", "expression-template-argument"); accept(ast->expression, "expression"); } void ASTPrinter::visit(ThrowExceptionSpecifierAST* ast) { - out_ << cxx::format("{}\n", "throw-exception-specifier"); + out_ << std::format("{}\n", "throw-exception-specifier"); } void ASTPrinter::visit(NoexceptSpecifierAST* ast) { - out_ << cxx::format("{}\n", "noexcept-specifier"); + out_ << std::format("{}\n", "noexcept-specifier"); accept(ast->expression, "expression"); } void ASTPrinter::visit(SimpleRequirementAST* ast) { - out_ << cxx::format("{}\n", "simple-requirement"); + out_ << std::format("{}\n", "simple-requirement"); accept(ast->expression, "expression"); } void ASTPrinter::visit(CompoundRequirementAST* ast) { - out_ << cxx::format("{}\n", "compound-requirement"); + out_ << std::format("{}\n", "compound-requirement"); accept(ast->expression, "expression"); accept(ast->typeConstraint, "type-constraint"); } void ASTPrinter::visit(TypeRequirementAST* ast) { - out_ << cxx::format("{}\n", "type-requirement"); + out_ << std::format("{}\n", "type-requirement"); accept(ast->nestedNameSpecifier, "nested-name-specifier"); accept(ast->unqualifiedId, "unqualified-id"); } void ASTPrinter::visit(NestedRequirementAST* ast) { - out_ << cxx::format("{}\n", "nested-requirement"); + out_ << std::format("{}\n", "nested-requirement"); accept(ast->expression, "expression"); } void ASTPrinter::visit(NewParenInitializerAST* ast) { - out_ << cxx::format("{}\n", "new-paren-initializer"); + out_ << std::format("{}\n", "new-paren-initializer"); if (ast->expressionList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "expression-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "expression-list"); for (auto it = ast->expressionList; it; it = it->next) { accept(it->value); } @@ -2269,18 +2269,18 @@ void ASTPrinter::visit(NewParenInitializerAST* ast) { } void ASTPrinter::visit(NewBracedInitializerAST* ast) { - out_ << cxx::format("{}\n", "new-braced-initializer"); + out_ << std::format("{}\n", "new-braced-initializer"); accept(ast->bracedInitList, "braced-init-list"); } void ASTPrinter::visit(ParenMemInitializerAST* ast) { - out_ << cxx::format("{}\n", "paren-mem-initializer"); + out_ << std::format("{}\n", "paren-mem-initializer"); accept(ast->nestedNameSpecifier, "nested-name-specifier"); accept(ast->unqualifiedId, "unqualified-id"); if (ast->expressionList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "expression-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "expression-list"); for (auto it = ast->expressionList; it; it = it->next) { accept(it->value); } @@ -2289,52 +2289,52 @@ void ASTPrinter::visit(ParenMemInitializerAST* ast) { } void ASTPrinter::visit(BracedMemInitializerAST* ast) { - out_ << cxx::format("{}\n", "braced-mem-initializer"); + out_ << std::format("{}\n", "braced-mem-initializer"); accept(ast->nestedNameSpecifier, "nested-name-specifier"); accept(ast->unqualifiedId, "unqualified-id"); accept(ast->bracedInitList, "braced-init-list"); } void ASTPrinter::visit(ThisLambdaCaptureAST* ast) { - out_ << cxx::format("{}\n", "this-lambda-capture"); + out_ << std::format("{}\n", "this-lambda-capture"); } void ASTPrinter::visit(DerefThisLambdaCaptureAST* ast) { - out_ << cxx::format("{}\n", "deref-this-lambda-capture"); + out_ << std::format("{}\n", "deref-this-lambda-capture"); } void ASTPrinter::visit(SimpleLambdaCaptureAST* ast) { - out_ << cxx::format("{}\n", "simple-lambda-capture"); + out_ << std::format("{}\n", "simple-lambda-capture"); accept(ast->identifier, "identifier"); } void ASTPrinter::visit(RefLambdaCaptureAST* ast) { - out_ << cxx::format("{}\n", "ref-lambda-capture"); + out_ << std::format("{}\n", "ref-lambda-capture"); accept(ast->identifier, "identifier"); } void ASTPrinter::visit(RefInitLambdaCaptureAST* ast) { - out_ << cxx::format("{}\n", "ref-init-lambda-capture"); + out_ << std::format("{}\n", "ref-init-lambda-capture"); accept(ast->identifier, "identifier"); accept(ast->initializer, "initializer"); } void ASTPrinter::visit(InitLambdaCaptureAST* ast) { - out_ << cxx::format("{}\n", "init-lambda-capture"); + out_ << std::format("{}\n", "init-lambda-capture"); accept(ast->identifier, "identifier"); accept(ast->initializer, "initializer"); } void ASTPrinter::visit(EllipsisExceptionDeclarationAST* ast) { - out_ << cxx::format("{}\n", "ellipsis-exception-declaration"); + out_ << std::format("{}\n", "ellipsis-exception-declaration"); } void ASTPrinter::visit(TypeExceptionDeclarationAST* ast) { - out_ << cxx::format("{}\n", "type-exception-declaration"); + out_ << std::format("{}\n", "type-exception-declaration"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -2342,8 +2342,8 @@ void ASTPrinter::visit(TypeExceptionDeclarationAST* ast) { } if (ast->typeSpecifierList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "type-specifier-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "type-specifier-list"); for (auto it = ast->typeSpecifierList; it; it = it->next) { accept(it->value); } @@ -2353,12 +2353,12 @@ void ASTPrinter::visit(TypeExceptionDeclarationAST* ast) { } void ASTPrinter::visit(CxxAttributeAST* ast) { - out_ << cxx::format("{}\n", "cxx-attribute"); + out_ << std::format("{}\n", "cxx-attribute"); accept(ast->attributeUsingPrefix, "attribute-using-prefix"); if (ast->attributeList) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("{}\n", "attribute-list"); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); for (auto it = ast->attributeList; it; it = it->next) { accept(it->value); } @@ -2367,49 +2367,49 @@ void ASTPrinter::visit(CxxAttributeAST* ast) { } void ASTPrinter::visit(GccAttributeAST* ast) { - out_ << cxx::format("{}\n", "gcc-attribute"); + out_ << std::format("{}\n", "gcc-attribute"); } void ASTPrinter::visit(AlignasAttributeAST* ast) { - out_ << cxx::format("{}\n", "alignas-attribute"); + out_ << std::format("{}\n", "alignas-attribute"); if (ast->isPack) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-pack: {}\n", ast->isPack); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-pack: {}\n", ast->isPack); --indent_; } accept(ast->expression, "expression"); } void ASTPrinter::visit(AlignasTypeAttributeAST* ast) { - out_ << cxx::format("{}\n", "alignas-type-attribute"); + out_ << std::format("{}\n", "alignas-type-attribute"); if (ast->isPack) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("is-pack: {}\n", ast->isPack); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-pack: {}\n", ast->isPack); --indent_; } accept(ast->typeId, "type-id"); } void ASTPrinter::visit(AsmAttributeAST* ast) { - out_ << cxx::format("{}\n", "asm-attribute"); + out_ << std::format("{}\n", "asm-attribute"); if (ast->literal) { ++indent_; - out_ << cxx::format("{:{}}", "", indent_ * 2); - out_ << cxx::format("literal: {}\n", ast->literal->value()); + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("literal: {}\n", ast->literal->value()); --indent_; } } void ASTPrinter::visit(ScopedAttributeTokenAST* ast) { - out_ << cxx::format("{}\n", "scoped-attribute-token"); + out_ << std::format("{}\n", "scoped-attribute-token"); accept(ast->attributeNamespace, "attribute-namespace"); accept(ast->identifier, "identifier"); } void ASTPrinter::visit(SimpleAttributeTokenAST* ast) { - out_ << cxx::format("{}\n", "simple-attribute-token"); + out_ << std::format("{}\n", "simple-attribute-token"); accept(ast->identifier, "identifier"); } diff --git a/src/frontend/cxx/cli.cc b/src/frontend/cxx/cli.cc index 840b6d30..94118999 100644 --- a/src/frontend/cxx/cli.cc +++ b/src/frontend/cxx/cli.cc @@ -20,11 +20,11 @@ #include "cli.h" -#include #include #include #include +#include #include #include #include @@ -36,15 +36,15 @@ namespace cxx { auto to_string(const CLIMatch& match) -> std::string { struct Process { auto operator()(const CLIFlag& o) const -> std::string { - return cxx::format("{}=true", std::get<0>(o)); + return std::format("{}=true", std::get<0>(o)); } auto operator()(const CLIOption& o) const -> std::string { - return cxx::format("{}={}", std::get<0>(o), std::get<1>(o)); + return std::format("{}={}", std::get<0>(o), std::get<1>(o)); } auto operator()(const CLIPositional& o) const -> std::string { - return cxx::format("{}", std::get<0>(o)); + return std::format("{}", std::get<0>(o)); } }; return std::visit(Process(), match); @@ -329,7 +329,7 @@ void CLI::parse(int& argc, char**& argv) { continue; } - std::cerr << cxx::format("missing argument after '{}'\n", arg); + std::cerr << std::format("missing argument after '{}'\n", arg); continue; } } @@ -345,13 +345,13 @@ void CLI::parse(int& argc, char**& argv) { continue; } - std::cerr << cxx::format("unsupported option '{}'\n", arg); + std::cerr << std::format("unsupported option '{}'\n", arg); } } void CLI::showHelp() { - std::cerr << cxx::format("Usage: cxx [options] file...\n"); - std::cerr << cxx::format("Options:\n"); + std::cerr << std::format("Usage: cxx [options] file...\n"); + std::cerr << std::format("Options:\n"); for (const auto& opt : options) { if (opt.visibility == CLIOptionVisibility::kExperimental) { continue; @@ -363,20 +363,20 @@ void CLI::showHelp() { if (opt.arg.empty()) { info = opt.option; } else { - info = cxx::format("{} {}", opt.option, opt.arg); + info = std::format("{} {}", opt.option, opt.arg); } break; } case CLIOptionDescrKind::kJoined: { - info = cxx::format("{}={}", opt.option, opt.arg); + info = std::format("{}={}", opt.option, opt.arg); break; } case CLIOptionDescrKind::kFlag: { - info = cxx::format("{}", opt.option); + info = std::format("{}", opt.option); break; } } // switch - std::cerr << cxx::format(" {:<28} {}\n", info, opt.help); + std::cerr << std::format(" {:<28} {}\n", info, opt.help); } } diff --git a/src/frontend/cxx/frontend.cc b/src/frontend/cxx/frontend.cc index 1d81a314..5b40c2ff 100644 --- a/src/frontend/cxx/frontend.cc +++ b/src/frontend/cxx/frontend.cc @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -34,12 +33,12 @@ #include #include #include -#include + +#include #include "ast_printer.h" #include "verify_diagnostics_client.h" - // std #include #include @@ -94,7 +93,7 @@ void dumpTokens(const CLI& cli, TranslationUnit& unit, std::ostream& output) { kind = Lexer::classifyKeyword(tk.spell()); } - output << cxx::format("{} '{}'{}\n", Token::name(kind), tk.spell(), flags); + output << std::format("{} '{}'{}\n", Token::name(kind), tk.spell(), flags); if (tk.is(TokenKind::T_EOF_SYMBOL)) break; } @@ -191,12 +190,12 @@ auto runOnFile(const CLI& cli, const std::string& fileName) -> bool { } if (cli.opt_v) { - std::cerr << cxx::format("#include <...> search starts here:\n"); + std::cerr << std::format("#include <...> search starts here:\n"); const auto& paths = preprocesor->systemIncludePaths(); for (auto it = rbegin(paths); it != rend(paths); ++it) { - std::cerr << cxx::format(" {}\n", *it); + std::cerr << std::format(" {}\n", *it); } - std::cerr << cxx::format("End of search list.\n"); + std::cerr << std::format("End of search list.\n"); } for (const auto& macro : cli.get("-D")) { @@ -231,7 +230,7 @@ auto runOnFile(const CLI& cli, const std::string& fileName) -> bool { preprocesor->setOnWillIncludeHeader( [&](const std::string& header, int level) { std::string fill(level, '.'); - std::cout << cxx::format("{} {}\n", fill, header); + std::cout << std::format("{} {}\n", fill, header); }); } @@ -255,7 +254,7 @@ auto runOnFile(const CLI& cli, const std::string& fileName) -> bool { } } } else { - std::cerr << cxx::format("cxx: No such file or directory: '{}'\n", + std::cerr << std::format("cxx: No such file or directory: '{}'\n", fileName); return false; } diff --git a/src/js/cxx/api.cc b/src/js/cxx/api.cc index 0a63c4ef..ccf2b3d9 100644 --- a/src/js/cxx/api.cc +++ b/src/js/cxx/api.cc @@ -25,13 +25,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include using namespace emscripten; diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index 784c2f07..f3b12f50 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -41,8 +41,7 @@ if (EMSCRIPTEN) endif() target_link_libraries(cxx-parser - PUBLIC $ - $ + PUBLIC $ ) add_custom_command(OUTPUT keywords-priv.h diff --git a/src/parser/cxx/const_expression_evaluator.cc b/src/parser/cxx/const_expression_evaluator.cc index a5f140e3..054722f0 100644 --- a/src/parser/cxx/const_expression_evaluator.cc +++ b/src/parser/cxx/const_expression_evaluator.cc @@ -26,12 +26,13 @@ #include #include #include -#include #include #include #include #include +#include + namespace cxx { auto ConstExpressionEvaluator::evaluate(ExpressionAST* ast) diff --git a/src/parser/cxx/cxx.cc b/src/parser/cxx/cxx.cc index de4d68be..8a09ca43 100644 --- a/src/parser/cxx/cxx.cc +++ b/src/parser/cxx/cxx.cc @@ -19,9 +19,9 @@ // SOFTWARE. #include -#include #include +#include #include #if __cpp_exceptions @@ -34,7 +34,7 @@ namespace cxx { #if __cpp_exceptions throw std::runtime_error(msg); #else - std::cerr << cxx::format("cxx_runtime_error: {}\n", msg); + std::cerr << std::format("cxx_runtime_error: {}\n", msg); std::abort(); #endif } diff --git a/src/parser/cxx/diagnostics_client.cc b/src/parser/cxx/diagnostics_client.cc index 97694a65..309e73e5 100644 --- a/src/parser/cxx/diagnostics_client.cc +++ b/src/parser/cxx/diagnostics_client.cc @@ -22,10 +22,10 @@ // cxx #include -#include #include #include +#include #include namespace cxx { @@ -57,7 +57,7 @@ void DiagnosticsClient::report(const Diagnostic& diag) { preprocessor_->getTokenStartPosition(diag.token(), &line, &column, &fileName); if (!fileName.empty()) { - std::cerr << cxx::format("{}:{}:{}: {}\n", fileName, line, column, + std::cerr << std::format("{}:{}:{}: {}\n", fileName, line, column, diag.message()); const auto textLine = preprocessor_->getTextLine(diag.token()); @@ -70,9 +70,9 @@ void DiagnosticsClient::report(const Diagnostic& diag) { if (!std::isspace(ch)) ch = ' '; } - std::cerr << cxx::format("{0}\n{1}^\n", textLine, indent); + std::cerr << std::format("{0}\n{1}^\n", textLine, indent); } else { - std::cerr << cxx::format("{}\n", diag.message()); + std::cerr << std::format("{}\n", diag.message()); } if (diag.severity() == Severity::Fatal || diff --git a/src/parser/cxx/flatbuffers/ast_encoder.cc b/src/parser/cxx/flatbuffers/ast_encoder.cc index 220d49ba..f9525e24 100644 --- a/src/parser/cxx/flatbuffers/ast_encoder.cc +++ b/src/parser/cxx/flatbuffers/ast_encoder.cc @@ -25,10 +25,10 @@ #include #include #include -#include #include #include +#include namespace cxx { diff --git a/src/parser/cxx/gcc_linux_toolchain.cc b/src/parser/cxx/gcc_linux_toolchain.cc index 9183e399..8a7c5d06 100644 --- a/src/parser/cxx/gcc_linux_toolchain.cc +++ b/src/parser/cxx/gcc_linux_toolchain.cc @@ -20,9 +20,10 @@ #include #include -#include #include +#include + namespace cxx { GCCLinuxToolchain::GCCLinuxToolchain(Preprocessor* preprocessor, @@ -30,7 +31,7 @@ GCCLinuxToolchain::GCCLinuxToolchain(Preprocessor* preprocessor, : Toolchain(preprocessor), arch_(std::move(arch)) { for (int version : {14, 13, 12, 11, 10, 9}) { const auto path = fs::path( - cxx::format("/usr/lib/gcc/{}-linux-gnu/{}/include", arch_, version)); + std::format("/usr/lib/gcc/{}-linux-gnu/{}/include", arch_, version)); if (exists(path)) { version_ = version; @@ -42,11 +43,11 @@ GCCLinuxToolchain::GCCLinuxToolchain(Preprocessor* preprocessor, void GCCLinuxToolchain::addSystemIncludePaths() { auto addSystemIncludePathForGCCVersion = [this](int version) { addSystemIncludePath( - cxx::format("/usr/lib/gcc/{}-linux-gnu/{}/include", arch_, version)); + std::format("/usr/lib/gcc/{}-linux-gnu/{}/include", arch_, version)); }; addSystemIncludePath("/usr/include"); - addSystemIncludePath(cxx::format("/usr/include/{}-linux-gnu", arch_)); + addSystemIncludePath(std::format("/usr/include/{}-linux-gnu", arch_)); addSystemIncludePath("/usr/local/include"); if (version_) addSystemIncludePathForGCCVersion(*version_); @@ -54,12 +55,12 @@ void GCCLinuxToolchain::addSystemIncludePaths() { void GCCLinuxToolchain::addSystemCppIncludePaths() { auto addSystemIncludePathForGCCVersion = [this](int version) { - addSystemIncludePath(cxx::format("/usr/include/c++/{}/backward", version)); + addSystemIncludePath(std::format("/usr/include/c++/{}/backward", version)); addSystemIncludePath( - cxx::format("/usr/include/{}-linux-gnu/c++/{}", arch_, version)); + std::format("/usr/include/{}-linux-gnu/c++/{}", arch_, version)); - addSystemIncludePath(cxx::format("/usr/include/c++/{}", version)); + addSystemIncludePath(std::format("/usr/include/c++/{}", version)); }; if (version_) addSystemIncludePathForGCCVersion(*version_); diff --git a/src/parser/cxx/literals.cc b/src/parser/cxx/literals.cc index 5f37e34c..322d34a7 100644 --- a/src/parser/cxx/literals.cc +++ b/src/parser/cxx/literals.cc @@ -22,9 +22,9 @@ // cxx #include -#include #include +#include namespace cxx { diff --git a/src/parser/cxx/macos_toolchain.cc b/src/parser/cxx/macos_toolchain.cc index 93914191..db65f2a3 100644 --- a/src/parser/cxx/macos_toolchain.cc +++ b/src/parser/cxx/macos_toolchain.cc @@ -20,32 +20,33 @@ #include #include -#include #include +#include + namespace cxx { MacOSToolchain::MacOSToolchain(Preprocessor* preprocessor) : Toolchain(preprocessor) { std::string xcodeContentsBasePath = "/Applications/Xcode.app/Contents"; - platformPath_ = cxx::format( + platformPath_ = std::format( "{}/Developer/Platforms/MacOSX.platform/" "Developer/SDKs/MacOSX.sdk", xcodeContentsBasePath); toolchainPath_ = - cxx::format("{}/Developer/Toolchains/XcodeDefault.xctoolchain", + std::format("{}/Developer/Toolchains/XcodeDefault.xctoolchain", xcodeContentsBasePath); } void MacOSToolchain::addSystemIncludePaths() { addSystemIncludePath( - cxx::format("{}/System/Library/Frameworks", platformPath_)); + std::format("{}/System/Library/Frameworks", platformPath_)); - addSystemIncludePath(cxx::format("{}/usr/include", toolchainPath_)); + addSystemIncludePath(std::format("{}/usr/include", toolchainPath_)); - addSystemIncludePath(cxx::format("{}/usr/include", platformPath_)); + addSystemIncludePath(std::format("{}/usr/include", platformPath_)); std::vector versions{ "15.0.0", @@ -53,7 +54,7 @@ void MacOSToolchain::addSystemIncludePaths() { for (auto version : versions) { const std::string path = - cxx::format("{}/usr/lib/clang/{}/include", toolchainPath_, version); + std::format("{}/usr/lib/clang/{}/include", toolchainPath_, version); if (fs::exists(path)) { addSystemIncludePath(path); } @@ -61,7 +62,7 @@ void MacOSToolchain::addSystemIncludePaths() { } void MacOSToolchain::addSystemCppIncludePaths() { - addSystemIncludePath(cxx::format("{}/usr/include/c++/v1", platformPath_)); + addSystemIncludePath(std::format("{}/usr/include/c++/v1", platformPath_)); } void MacOSToolchain::addPredefinedMacros() { diff --git a/src/parser/cxx/name_printer.cc b/src/parser/cxx/name_printer.cc index 0a1d35c9..53ed559e 100644 --- a/src/parser/cxx/name_printer.cc +++ b/src/parser/cxx/name_printer.cc @@ -20,11 +20,12 @@ #include #include -#include #include #include #include +#include + namespace cxx { struct { @@ -53,7 +54,7 @@ auto NamePrinter::operator()(const OperatorId* name) const -> std::string { case TokenKind::T_DELETE_ARRAY: return "operator delete[]"; default: - return cxx::format("operator {}", Token::spell(name->op())); + return std::format("operator {}", Token::spell(name->op())); } // switch } @@ -63,12 +64,12 @@ auto NamePrinter::operator()(const DestructorId* name) const -> std::string { auto NamePrinter::operator()(const LiteralOperatorId* name) const -> std::string { - return cxx::format("operator \"\"{}", name->name()); + return std::format("operator \"\"{}", name->name()); } auto NamePrinter::operator()(const ConversionFunctionId* name) const -> std::string { - return cxx::format("operator {}", to_string(name->type())); + return std::format("operator {}", to_string(name->type())); } auto NamePrinter::operator()(const TemplateId* name) const -> std::string { diff --git a/src/parser/cxx/parser.cc b/src/parser/cxx/parser.cc index 9057fd30..3dd5400b 100644 --- a/src/parser/cxx/parser.cc +++ b/src/parser/cxx/parser.cc @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -38,6 +37,7 @@ #include #include +#include namespace cxx { @@ -348,7 +348,7 @@ struct Parser::GetDeclaratorType { #if false if (!type_cast(returnType)) { p->parse_warn(ast->trailingReturnType->firstSourceLocation(), - cxx::format("function with trailing return type must " + std::format("function with trailing return type must " "be declared with 'auto', not '{}'", to_string(returnType))); } @@ -776,7 +776,7 @@ Parser::~Parser() = default; auto Parser::prec(TokenKind tk) -> Parser::Prec { switch (tk) { default: - cxx_runtime_error(cxx::format("expected a binary operator, found {}", + cxx_runtime_error(std::format("expected a binary operator, found {}", Token::spell(tk))); case TokenKind::T_DOT_STAR: @@ -842,7 +842,7 @@ auto Parser::match(TokenKind tk, SourceLocation& location) -> bool { auto Parser::expect(TokenKind tk, SourceLocation& location) -> bool { if (match(tk, location)) return true; - parse_error(cxx::format("expected '{}'", Token::spell(tk))); + parse_error(std::format("expected '{}'", Token::spell(tk))); return false; } @@ -2468,7 +2468,7 @@ auto Parser::parse_call_expression(ExpressionAST*& yyast, if (auto functionType = type_cast(ast->baseExpression->type)) { parse_warn(lparenLoc, - cxx::format("call function {}", to_string(functionType))); + std::format("call function {}", to_string(functionType))); } #endif @@ -3562,7 +3562,7 @@ auto Parser::parse_maybe_assignment_expression(ExpressionAST*& yyast, #if false parse_warning(ast->opLoc, - cxx::format("did convert {} to {}", to_string(sourceType), + std::format("did convert {} to {}", to_string(sourceType), to_string(ast->type))); #endif } @@ -4780,7 +4780,7 @@ auto Parser::parse_simple_declaration( scope_ = scope; } else if (q && config_.checkTypes) { parse_error(q->firstSourceLocation(), - cxx::format("unresolved class or namespace")); + std::format("unresolved class or namespace")); } const Name* functionName = decl.getName(); @@ -4789,7 +4789,7 @@ auto Parser::parse_simple_declaration( if (!functionSymbol) { if (q && config_.checkTypes) { parse_error(q->firstSourceLocation(), - cxx::format("class or namespace has no member named '{}'", + std::format("class or namespace has no member named '{}'", to_string(functionName))); } @@ -4894,7 +4894,7 @@ auto Parser::parse_notypespec_function_definition( } else if (auto q = decl.getNestedNameSpecifier()) { if (config_.checkTypes) { parse_error(q->firstSourceLocation(), - cxx::format("unresolved class or namespace")); + std::format("unresolved class or namespace")); } } @@ -5553,7 +5553,7 @@ auto Parser::instantiate(SimpleTemplateIdAST* templateId) -> Symbol* { args.push_back(arg->typeId->type); } else { parse_error(it->value->firstSourceLocation(), - cxx::format("only type template arguments are supported")); + std::format("only type template arguments are supported")); } } @@ -5835,7 +5835,7 @@ void Parser::check_type_traits() { parse_warn( typeTraitLoc, - cxx::format("keyword '{}' will be made available as an identifier for " + std::format("keyword '{}' will be made available as an identifier for " "the remainder of the translation unit", Token::spell(builtinKind))); #endif @@ -6799,7 +6799,7 @@ auto Parser::parse_declarator(DeclaratorAST*& yyast, Decl& decl, scope_ = scope; } else if (q && config_.checkTypes) { parse_error(q->firstSourceLocation(), - cxx::format("unresolved class or namespace")); + std::format("unresolved class or namespace")); } List* declaratorChunkList = nullptr; diff --git a/src/parser/cxx/preprocessor.cc b/src/parser/cxx/preprocessor.cc index 24b2a1d8..bd39b079 100644 --- a/src/parser/cxx/preprocessor.cc +++ b/src/parser/cxx/preprocessor.cc @@ -29,7 +29,7 @@ #include // fmt -#include +#include // utf8 #include @@ -745,7 +745,7 @@ struct Preprocessor::Private { void error(const TokList *ts, std::string message) const { if (!ts || !ts->tok) { - cxx_runtime_error(cxx::format("no source location: {}", message)); + cxx_runtime_error(std::format("no source location: {}", message)); } else { diagnosticsClient_->report(ts->tok->token(), Severity::Error, std::move(message)); @@ -754,7 +754,7 @@ struct Preprocessor::Private { void warning(const TokList *ts, std::string message) const { if (!ts || !ts->tok) { - cxx_runtime_error(cxx::format("no source location: {}", message)); + cxx_runtime_error(std::format("no source location: {}", message)); } else { diagnosticsClient_->report(ts->tok->token(), Severity::Warning, std::move(message)); @@ -909,7 +909,7 @@ struct Preprocessor::Private { void expect(const TokList *&ts, TokenKind k) const { if (!match(ts, k)) { - error(ts, cxx::format("expected '{}'", Token::spell(k))); + error(ts, std::format("expected '{}'", Token::spell(k))); } } @@ -1248,7 +1248,7 @@ struct Preprocessor::ParseArguments { if (!cxx::lookat(it, last, TokenKind::T_RPAREN)) { d.error(lparen.toTokList(), - cxx::format("unterminated function-like macro invocation")); + std::format("unterminated function-like macro invocation")); return std::nullopt; } @@ -1303,7 +1303,7 @@ void Preprocessor::Private::initialize() { [this](const MacroExpansionContext &context) -> const TokList * { auto ts = context.ts; auto tk = gen(TokenKind::T_STRING_LITERAL, - string(cxx::format("\"{}\"", currentFileName_))); + string(std::format("\"{}\"", currentFileName_))); tk->space = true; tk->sourceFile = ts->tok->sourceFile; return cons(tk, ts->next); @@ -1435,7 +1435,7 @@ void Preprocessor::Private::initialize() { auto [args, rest, hideset] = parseArguments(context.ts, 0, true); if (args.empty()) { - error(macroName->token(), cxx::format("expected a header name")); + error(macroName->token(), std::format("expected a header name")); return replaceWithBoolLiteral(macroName, false, rest); } @@ -1722,7 +1722,7 @@ auto Preprocessor::Private::parseDirective(SourceFile *source, if (skipping) break; if (bol(ts)) { - error(ts, cxx::format("missing macro name")); + error(ts, std::format("missing macro name")); break; } @@ -1852,9 +1852,9 @@ auto Preprocessor::Private::parseDirective(SourceFile *source, #if 0 std::ostringstream out; printLine(start, out); - std::cerr << cxx::format("** todo pragma: "); + std::cerr << std::format("** todo pragma: "); printLine(ts, std::cerr); - std::cerr << cxx::format("\n"); + std::cerr << std::format("\n"); // cxx_runtime_error(out.str()); #endif break; @@ -1864,7 +1864,7 @@ auto Preprocessor::Private::parseDirective(SourceFile *source, std::ostringstream out; printLine(start, out, /*nl=*/false); - error(directive, cxx::format("{}", out.str())); + error(directive, std::format("{}", out.str())); break; } @@ -1874,7 +1874,7 @@ auto Preprocessor::Private::parseDirective(SourceFile *source, std::ostringstream out; printLine(start, out, /*nl=*/false); - warning(directive, cxx::format("{}", out.str())); + warning(directive, std::format("{}", out.str())); break; } @@ -1918,7 +1918,7 @@ auto Preprocessor::Private::resolveIncludeDirective( if (!path) { const auto file = getHeaderName(directive.header); - error(directive.loc, cxx::format("file '{}' not found", file)); + error(directive.loc, std::format("file '{}' not found", file)); return nullptr; } @@ -2481,7 +2481,7 @@ auto Preprocessor::Private::binaryExpressionHelper(const TokList *&ts, long lhs, break; default: cxx_runtime_error( - cxx::format("invalid operator '{}'", Token::spell(op))); + std::format("invalid operator '{}'", Token::spell(op))); } // switch } return lhs; @@ -2621,9 +2621,9 @@ auto Preprocessor::Private::parseMacroDefinition(const TokList *ts) -> Macro { void Preprocessor::Private::defineMacro(const TokList *ts) { #if 0 - std::cout << cxx::format("*** defining macro: "); + std::cout << std::format("*** defining macro: "); printLine(ts, std::cout); - std::cout << cxx::format("\n"); + std::cout << std::format("\n"); #endif auto macro = parseMacroDefinition(ts); @@ -2637,7 +2637,7 @@ void Preprocessor::Private::defineMacro(const TokList *ts) { if (auto it = macros_.find(name); it != macros_.end()) { auto previousMacroBody = getMacroBody(it->second); if (!TokList::isSame(getMacroBody(macro), previousMacroBody)) { - warning(ts, cxx::format("'{}' macro redefined", name)); + warning(ts, std::format("'{}' macro redefined", name)); } macros_.erase(it); @@ -2717,7 +2717,7 @@ void Preprocessor::Private::print(const TokList *ts, std::ostream &out) const { } else if (!first && needSpace(prevTk, tk)) { out << " "; } - out << cxx::format("{}", tk->text); + out << std::format("{}", tk->text); prevTk = tk; first = false; } @@ -2729,13 +2729,13 @@ void Preprocessor::Private::printLine(const TokList *ts, std::ostream &out, for (const Tok *prevTk = nullptr; ts; ts = ts->next) { auto tk = ts->tok; if (tk->text.empty()) continue; - if (!first && needSpace(prevTk, tk)) out << cxx::format(" "); - out << cxx::format("{}", tk->text); + if (!first && needSpace(prevTk, tk)) out << std::format(" "); + out << std::format("{}", tk->text); prevTk = tk; first = false; if (ts->next && bol(ts->next)) break; } - if (nl) out << cxx::format("\n"); + if (nl) out << std::format("\n"); } Preprocessor::Preprocessor(Control *control, @@ -2934,9 +2934,9 @@ void Preprocessor::getPreprocessedText(const std::vector &tokens, std::uint32_t line = 0, column = 0; getTokenStartPosition(token, &line, &column, nullptr); #if true - out << cxx::format("# {} \"{}\"\n", line, sourceFile.fileName); + out << std::format("# {} \"{}\"\n", line, sourceFile.fileName); #else - out << cxx::format("# {} \"{}:{}:{}\"\n", line, sourceFile.fileName, line, + out << std::format("# {} \"{}:{}:{}\"\n", line, sourceFile.fileName, line, column); #endif lastFileId = fileId; @@ -3007,40 +3007,40 @@ void Preprocessor::printMacros(std::ostream &out) const { void operator()(const FunctionMacro ¯o) { auto d = self.d.get(); - out << cxx::format("#define {}", macro.name); + out << std::format("#define {}", macro.name); - out << cxx::format("("); + out << std::format("("); for (std::size_t i = 0; i < macro.formals.size(); ++i) { if (i > 0) out << ","; - out << cxx::format("{}", macro.formals[i]); + out << std::format("{}", macro.formals[i]); } if (macro.variadic) { - if (!macro.formals.empty()) out << cxx::format(","); - out << cxx::format("..."); + if (!macro.formals.empty()) out << std::format(","); + out << std::format("..."); } - out << cxx::format(")"); + out << std::format(")"); if (macro.body) { - out << cxx::format(" "); + out << std::format(" "); d->print(macro.body, out); } - out << cxx::format("\n"); + out << std::format("\n"); } void operator()(const ObjectMacro ¯o) { auto d = self.d.get(); - out << cxx::format("#define {}", macro.name); + out << std::format("#define {}", macro.name); if (macro.body) { - out << cxx::format(" "); + out << std::format(" "); d->print(macro.body, out); } - out << cxx::format("\n"); + out << std::format("\n"); } void operator()(const BuiltinObjectMacro &) {} diff --git a/src/parser/cxx/private/format.h b/src/parser/cxx/private/format.h deleted file mode 100644 index 12043cc5..00000000 --- a/src/parser/cxx/private/format.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2024 Roberto Raggi -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include - -#if defined(__cpp_lib_format) || defined(__EMSCRIPTEN__) - -#include - -namespace cxx { -using std::format; -} - -#else - -#include - -namespace cxx { -using fmt::format; -} - -#endif diff --git a/src/parser/cxx/symbol_instantiation.cc b/src/parser/cxx/symbol_instantiation.cc index ad6cbce5..22d3371d 100644 --- a/src/parser/cxx/symbol_instantiation.cc +++ b/src/parser/cxx/symbol_instantiation.cc @@ -23,12 +23,13 @@ // cxx #include #include -#include #include #include #include #include +#include + namespace cxx { struct SymbolInstantiation::MakeSymbol { diff --git a/src/parser/cxx/symbol_printer.cc b/src/parser/cxx/symbol_printer.cc index 33f345a0..dcd01a12 100644 --- a/src/parser/cxx/symbol_printer.cc +++ b/src/parser/cxx/symbol_printer.cc @@ -22,12 +22,12 @@ // cxx #include -#include #include #include #include #include +#include #include #include @@ -60,7 +60,7 @@ struct DumpSymbols { if (specializations.empty()) return; ++depth; indent(); - out << cxx::format("[specializations]\n"); + out << std::format("[specializations]\n"); ++depth; for (auto specialization : specializations) { visit(*this, specialization.symbol); @@ -68,17 +68,17 @@ struct DumpSymbols { depth -= 2; } - void indent() { out << cxx::format("{:{}}", "", depth * 2); } + void indent() { out << std::format("{:{}}", "", depth * 2); } void operator()(NamespaceSymbol* symbol) { indent(); - out << cxx::format("namespace {}\n", to_string(symbol->name())); + out << std::format("namespace {}\n", to_string(symbol->name())); dumpScope(symbol->scope()); } void operator()(BaseClassSymbol* symbol) { indent(); - out << cxx::format("base class {}\n", to_string(symbol->name())); + out << std::format("base class {}\n", to_string(symbol->name())); } void operator()(ClassSymbol* symbol) { @@ -86,21 +86,21 @@ struct DumpSymbols { std::string_view classKey = symbol->isUnion() ? "union" : "class"; if (symbol->templateParameters()) { - out << cxx::format("template {} {}\n", classKey, + out << std::format("template {} {}\n", classKey, to_string(symbol->name())); dumpScope(symbol->templateParameters()->scope()); } else if (symbol->isSpecialization()) { - out << cxx::format("{} {}<", classKey, to_string(symbol->name())); + out << std::format("{} {}<", classKey, to_string(symbol->name())); std::string_view sep = ""; for (auto arg : symbol->templateArguments()) { auto type = std::get_if(&arg); if (!type) continue; - out << cxx::format("{}{}", sep, to_string(*type)); + out << std::format("{}{}", sep, to_string(*type)); sep = ", "; } - out << cxx::format(">\n"); + out << std::format(">\n"); } else { - out << cxx::format("{} {}\n", classKey, to_string(symbol->name())); + out << std::format("{} {}\n", classKey, to_string(symbol->name())); } dumpScope(symbol->scope()); dumpSpecializations(symbol->specializations()); @@ -108,33 +108,33 @@ struct DumpSymbols { void operator()(ConceptSymbol* symbol) { indent(); - out << cxx::format("concept {}\n", to_string(symbol->name())); + out << std::format("concept {}\n", to_string(symbol->name())); if (symbol->templateParameters()) dumpScope(symbol->templateParameters()->scope()); } void operator()(EnumSymbol* symbol) { indent(); - out << cxx::format("enum {}", to_string(symbol->name())); + out << std::format("enum {}", to_string(symbol->name())); if (auto underlyingType = symbol->underlyingType()) { - out << cxx::format(" : {}", to_string(underlyingType)); + out << std::format(" : {}", to_string(underlyingType)); } - out << cxx::format("\n"); + out << std::format("\n"); dumpScope(symbol->scope()); } void operator()(ScopedEnumSymbol* symbol) { indent(); - out << cxx::format("enum class {}", to_string(symbol->name())); + out << std::format("enum class {}", to_string(symbol->name())); if (auto underlyingType = symbol->underlyingType()) { - out << cxx::format(" : {}", to_string(underlyingType)); + out << std::format(" : {}", to_string(underlyingType)); } - out << cxx::format("\n"); + out << std::format("\n"); dumpScope(symbol->scope()); } @@ -149,10 +149,10 @@ struct DumpSymbols { indent(); if (symbol->templateParameters()) { - out << cxx::format("template "); + out << std::format("template "); } - out << cxx::format("function"); + out << std::format("function"); if (symbol->isStatic()) out << " static"; if (symbol->isExtern()) out << " extern"; @@ -165,7 +165,7 @@ struct DumpSymbols { if (symbol->isDeleted()) out << " deleted"; if (symbol->isDefaulted()) out << " defaulted"; - out << cxx::format(" {}\n", to_string(symbol->type(), symbol->name())); + out << std::format(" {}\n", to_string(symbol->type(), symbol->name())); if (symbol->templateParameters()) { dumpScope(symbol->templateParameters()->scope()); @@ -177,44 +177,44 @@ struct DumpSymbols { void operator()(LambdaSymbol* symbol) { indent(); - out << cxx::format("lambda"); + out << std::format("lambda"); if (symbol->isConstexpr()) out << " constexpr"; if (symbol->isConsteval()) out << " consteval"; if (symbol->isMutable()) out << " mutable"; if (symbol->isStatic()) out << " static"; - out << cxx::format("{}\n", to_string(symbol->type(), symbol->name())); + out << std::format("{}\n", to_string(symbol->type(), symbol->name())); dumpScope(symbol->scope()); } void operator()(TemplateParametersSymbol* symbol) { indent(); - out << cxx::format("template parameters\n"); + out << std::format("template parameters\n"); dumpScope(symbol->scope()); } void operator()(FunctionParametersSymbol* symbol) { indent(); - out << cxx::format("parameters\n"); + out << std::format("parameters\n"); dumpScope(symbol->scope()); } void operator()(BlockSymbol* symbol) { indent(); - out << cxx::format("block\n"); + out << std::format("block\n"); dumpScope(symbol->scope()); } void operator()(TypeAliasSymbol* symbol) { indent(); if (symbol->templateParameters()) { - out << cxx::format("template typealias {}\n", + out << std::format("template typealias {}\n", to_string(symbol->type(), symbol->name())); dumpScope(symbol->templateParameters()->scope()); } else { - out << cxx::format("typealias {}\n", + out << std::format("typealias {}\n", to_string(symbol->type(), symbol->name())); } } @@ -222,9 +222,9 @@ struct DumpSymbols { void operator()(VariableSymbol* symbol) { indent(); - if (symbol->templateParameters()) out << cxx::format("template "); + if (symbol->templateParameters()) out << std::format("template "); - out << cxx::format("variable"); + out << std::format("variable"); if (symbol->isStatic()) out << " static"; if (symbol->isThreadLocal()) out << " thread_local"; @@ -233,7 +233,7 @@ struct DumpSymbols { if (symbol->isConstinit()) out << " constinit"; if (symbol->isInline()) out << " inline"; - out << cxx::format(" {}\n", to_string(symbol->type(), symbol->name())); + out << std::format(" {}\n", to_string(symbol->type(), symbol->name())); if (symbol->templateParameters()) { dumpScope(symbol->templateParameters()->scope()); @@ -243,7 +243,7 @@ struct DumpSymbols { void operator()(FieldSymbol* symbol) { indent(); - out << cxx::format("field"); + out << std::format("field"); if (symbol->isStatic()) out << " static"; if (symbol->isThreadLocal()) out << " thread_local"; @@ -251,26 +251,26 @@ struct DumpSymbols { if (symbol->isConstinit()) out << " constinit"; if (symbol->isInline()) out << " inline"; - out << cxx::format(" {}\n", to_string(symbol->type(), symbol->name())); + out << std::format(" {}\n", to_string(symbol->type(), symbol->name())); } void operator()(ParameterSymbol* symbol) { indent(); - out << cxx::format("parameter {}\n", + out << std::format("parameter {}\n", to_string(symbol->type(), symbol->name())); } void operator()(TypeParameterSymbol* symbol) { std::string_view pack = symbol->isParameterPack() ? "..." : ""; indent(); - out << cxx::format("parameter typename<{}, {}>{} {}\n", symbol->index(), + out << std::format("parameter typename<{}, {}>{} {}\n", symbol->index(), symbol->depth(), pack, to_string(symbol->name())); } void operator()(NonTypeParameterSymbol* symbol) { std::string_view pack = symbol->isParameterPack() ? "..." : ""; indent(); - out << cxx::format("parameter object<{}, {}, {}>{} {}\n", symbol->index(), + out << std::format("parameter object<{}, {}, {}>{} {}\n", symbol->index(), symbol->depth(), to_string(symbol->objectType()), pack, to_string(symbol->name())); } @@ -278,20 +278,20 @@ struct DumpSymbols { void operator()(TemplateTypeParameterSymbol* symbol) { std::string_view pack = symbol->isParameterPack() ? "..." : ""; indent(); - out << cxx::format("parameter template<{}, {}>{} {}\n", symbol->index(), + out << std::format("parameter template<{}, {}>{} {}\n", symbol->index(), symbol->depth(), pack, to_string(symbol->name())); } void operator()(ConstraintTypeParameterSymbol* symbol) { std::string_view pack = symbol->isParameterPack() ? "..." : ""; indent(); - out << cxx::format("parameter constraint<{}, {}>{} {}\n", symbol->index(), + out << std::format("parameter constraint<{}, {}>{} {}\n", symbol->index(), symbol->depth(), pack, to_string(symbol->name())); } void operator()(EnumeratorSymbol* symbol) { indent(); - out << cxx::format("enumerator {}\n", + out << std::format("enumerator {}\n", to_string(symbol->type(), symbol->name())); } }; diff --git a/src/parser/cxx/type_printer.cc b/src/parser/cxx/type_printer.cc index e7413c55..7feabc68 100644 --- a/src/parser/cxx/type_printer.cc +++ b/src/parser/cxx/type_printer.cc @@ -24,11 +24,12 @@ #include #include #include -#include #include #include #include +#include + namespace cxx { namespace { @@ -308,7 +309,7 @@ class TypePrinter { for (auto arg : type->symbol()->templateArguments()) { auto type = std::get_if(&arg); if (!type) continue; - out += cxx::format("{}{}", sep, to_string(*type)); + out += std::format("{}{}", sep, to_string(*type)); sep = ", "; } out += '>'; diff --git a/src/parser/cxx/wasm32_wasi_toolchain.cc b/src/parser/cxx/wasm32_wasi_toolchain.cc index b636ec14..3aed9a1f 100644 --- a/src/parser/cxx/wasm32_wasi_toolchain.cc +++ b/src/parser/cxx/wasm32_wasi_toolchain.cc @@ -23,9 +23,10 @@ // cxx #include #include -#include #include +#include + namespace cxx { Wasm32WasiToolchain::Wasm32WasiToolchain(Preprocessor* preprocessor) @@ -60,14 +61,14 @@ void Wasm32WasiToolchain::setSysroot(std::string sysroot) { } void Wasm32WasiToolchain::addSystemIncludePaths() { - addSystemIncludePath(cxx::format("{}/include", sysroot_)); - addSystemIncludePath(cxx::format("{}/include/wasm32-wasi", sysroot_)); - addSystemIncludePath(cxx::format("{}/../lib/cxx/include", appdir_)); + addSystemIncludePath(std::format("{}/include", sysroot_)); + addSystemIncludePath(std::format("{}/include/wasm32-wasi", sysroot_)); + addSystemIncludePath(std::format("{}/../lib/cxx/include", appdir_)); } void Wasm32WasiToolchain::addSystemCppIncludePaths() { - addSystemIncludePath(cxx::format("{}/include/c++/v1", sysroot_)); - addSystemIncludePath(cxx::format("{}/include/wasm32-wasi/c++/v1", sysroot_)); + addSystemIncludePath(std::format("{}/include/c++/v1", sysroot_)); + addSystemIncludePath(std::format("{}/include/wasm32-wasi/c++/v1", sysroot_)); } void Wasm32WasiToolchain::addPredefinedMacros() { diff --git a/src/parser/cxx/windows_toolchain.cc b/src/parser/cxx/windows_toolchain.cc index ac69f9f6..1f842f3e 100644 --- a/src/parser/cxx/windows_toolchain.cc +++ b/src/parser/cxx/windows_toolchain.cc @@ -22,9 +22,9 @@ // cxx #include -#include #include +#include #include namespace cxx { @@ -44,22 +44,22 @@ void WindowsToolchain::setWinsdkversion(std::string version) { void WindowsToolchain::addSystemIncludePaths() { addSystemIncludePath( (fs::path(winsdkdir_) / - std::string(cxx::format("Include/{}/winrt", winsdkversion_))) + std::string(std::format("Include/{}/winrt", winsdkversion_))) .string()); addSystemIncludePath( (fs::path(winsdkdir_) / - std::string(cxx::format("Include/{}/um", winsdkversion_))) + std::string(std::format("Include/{}/um", winsdkversion_))) .string()); addSystemIncludePath( (fs::path(winsdkdir_) / - std::string(cxx::format("Include/{}/shared", winsdkversion_))) + std::string(std::format("Include/{}/shared", winsdkversion_))) .string()); addSystemIncludePath( (fs::path(winsdkdir_) / - std::string(cxx::format("Include/{}/ucrt", winsdkversion_))) + std::string(std::format("Include/{}/ucrt", winsdkversion_))) .string()); addSystemIncludePath( diff --git a/tests/api_tests/test_substitution.cc b/tests/api_tests/test_substitution.cc index bcb018bf..0814d1e7 100644 --- a/tests/api_tests/test_substitution.cc +++ b/tests/api_tests/test_substitution.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -32,6 +31,7 @@ #include #include +#include #include #include