diff --git a/packages/cxx-gen-ast/src/gen.ts b/packages/cxx-gen-ast/src/gen.ts index defdcb95..d94ba47e 100644 --- a/packages/cxx-gen-ast/src/gen.ts +++ b/packages/cxx-gen-ast/src/gen.ts @@ -67,11 +67,11 @@ gen_ast_visitor_h({ }); gen_ast_dump_h({ ast, - output: path.join(outdir, "src/frontend/cxx/ast_printer.h"), + output: path.join(outdir, "src/parser/cxx/ast_printer.h"), }); gen_ast_dump_cc({ ast, - output: path.join(outdir, "src/frontend/cxx/ast_printer.cc"), + output: path.join(outdir, "src/parser/cxx/ast_printer.cc"), }); gen_ast_kind_h({ ast, output: path.join(outdir, "src/parser/cxx/ast_kind.h") }); gen_ast_slot_h({ ast, output: path.join(outdir, "src/parser/cxx/ast_slot.h") }); 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 b8f21ba6..f95bc454 100644 --- a/packages/cxx-gen-ast/src/gen_ast_dump_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_dump_cc.ts @@ -108,7 +108,9 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) { if (base == "ExpressionAST") { emit(` out_ << "${astName(name)}";`); emit(` if (ast->type) {`); - emit(` out_ << std::format(" [{} {}]", to_string(ast->valueCategory), to_string(ast->type));`); + emit( + ` out_ << std::format(" [{} {}]", to_string(ast->valueCategory), to_string(ast->type));` + ); emit(` }`); emit(` out_ << "\\n";`); } else { @@ -137,8 +139,9 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) { }); const out = `${cpy_header} -#include "ast_printer.h" +#include +// cxx #include #include #include diff --git a/src/frontend/CMakeLists.txt b/src/frontend/CMakeLists.txt index 36fbfd76..88ec001d 100644 --- a/src/frontend/CMakeLists.txt +++ b/src/frontend/CMakeLists.txt @@ -19,7 +19,6 @@ add_executable(cxx - cxx/ast_printer.cc cxx/frontend.cc cxx/verify_diagnostics_client.cc ) diff --git a/src/frontend/cxx/frontend.cc b/src/frontend/cxx/frontend.cc index be1440c5..3c02c994 100644 --- a/src/frontend/cxx/frontend.cc +++ b/src/frontend/cxx/frontend.cc @@ -41,6 +41,8 @@ #include #endif +#include + #include #include #include @@ -48,7 +50,6 @@ #include #include -#include "ast_printer.h" #include "verify_diagnostics_client.h" namespace { diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index b19ef89b..6b748d49 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -23,6 +23,7 @@ file(GLOB CXX_VIEWS_INCLUDE_HEADER_FILES cxx/views/*.h) add_library(cxx-parser cxx/ast_cursor.cc cxx/ast_interpreter.cc + cxx/ast_printer.cc cxx/ast_rewriter.cc cxx/ast_slot.cc cxx/ast.cc diff --git a/src/frontend/cxx/ast_printer.cc b/src/parser/cxx/ast_printer.cc similarity index 99% rename from src/frontend/cxx/ast_printer.cc rename to src/parser/cxx/ast_printer.cc index c9a502fe..a870f442 100644 --- a/src/frontend/cxx/ast_printer.cc +++ b/src/parser/cxx/ast_printer.cc @@ -18,8 +18,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#include "ast_printer.h" +#include +// cxx #include #include #include diff --git a/src/frontend/cxx/ast_printer.h b/src/parser/cxx/ast_printer.h similarity index 100% rename from src/frontend/cxx/ast_printer.h rename to src/parser/cxx/ast_printer.h