From 7aba3760b2928e01e669508bf2fe8f615139238c Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Fri, 5 Jan 2024 06:28:14 +0530 Subject: [PATCH 1/4] LC: Rename ast-dump and asr-dump to --show-ast and show-asr --- src/bin/lc.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bin/lc.cpp b/src/bin/lc.cpp index 68fc144..a85cb39 100644 --- a/src/bin/lc.cpp +++ b/src/bin/lc.cpp @@ -34,8 +34,6 @@ using namespace llvm; static cl::OptionCategory ClangCheckCategory("clang-check options"); static const opt::OptTable &Options = getDriverOptTable(); -static cl::opt ASTDump("ast-dump", - cl::desc(Options.getOptionHelpText(options::OPT_ast_dump)), cl::cat(ClangCheckCategory)); static cl::opt ASTDumpFile("ast-dump-file", cl::desc("dump the AST output in the specified file"), cl::cat(ClangCheckCategory)); static cl::opt ASTList("ast-list", @@ -47,7 +45,9 @@ static cl::opt ASTDumpFilter("ast-dump-filter", // LC options static cl::opt - ASRDump("asr-dump", cl::desc("dump the ASR"), cl::cat(ClangCheckCategory)); + ShowAST("show-ast", cl::desc("dump the AST"), cl::cat(ClangCheckCategory)); +static cl::opt + ShowASR("show-asr", cl::desc("dump the ASR"), cl::cat(ClangCheckCategory)); static cl::opt NoIndent("no-indent", cl::desc("do not indent output"), cl::cat(ClangCheckCategory)); static cl::opt @@ -132,7 +132,7 @@ class ClangCheckActionFactory { std::unique_ptr newASTConsumer() { if (ASTList) { return clang::CreateASTDeclNodeLister(); - } else if ( ASTDump ) { + } else if ( ShowAST ) { llvm::raw_fd_ostream* llvm_fd_ostream = nullptr; if( ASTDumpFile.size() > 0 ) { std::error_code errorCode; @@ -732,7 +732,7 @@ int main(int argc, const char **argv) { std::string infile = sourcePaths[0]; // Handle Clang related options in the following - if (ASTDump || ASTList || ASTPrint) { + if (ShowAST || ASTList || ASTPrint) { ClangCheckActionFactory CheckFactory(infile); int status = Tool.run(newFrontendActionFactory(&CheckFactory).get()); return status; @@ -748,7 +748,7 @@ int main(int argc, const char **argv) { return status; } - if (ASRDump) { + if (ShowASR) { bool indent = !NoIndent, color = !NoColor; std::cout<< LCompilers::pickle(*tu, color, indent, true) << std::endl; return 0; From 55be67adfaf4b09556c6136c46e73da5431d9ad8 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Fri, 5 Jan 2024 06:31:50 +0530 Subject: [PATCH 2/4] TEST: Update commands in run_tests.py --- run_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_tests.py b/run_tests.py index f00e34b..7db04c1 100755 --- a/run_tests.py +++ b/run_tests.py @@ -48,7 +48,7 @@ def is_included(backend): run_test( filename, "ast", - "lc --ast-dump {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"', + "lc --show-ast {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"', filename, update_reference, extra_args) @@ -56,7 +56,7 @@ def is_included(backend): run_test( filename, "asr", - "lc --asr-dump --no-color {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"', + "lc --show-asr --no-color {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"', filename, update_reference, extra_args) From fec4842c4427e8e205629074f083ff1b976be46a Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Fri, 5 Jan 2024 06:56:36 +0530 Subject: [PATCH 3/4] CI: Update commands to --show-ast and --show-asr --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7745a04..797d197 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -51,8 +51,8 @@ jobs: if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') run: | export CPATH=$CONDA_PREFIX/include:$CPATH - lc --ast-dump tests/test.cpp - lc examples/expr2.c --asr-dump + lc --show-ast tests/test.cpp + lc examples/expr2.c --show-asr ./run_tests.py - name: Test2 (Linux / macOS) From f0abe5302c71564295502ab03c85b01241dc21bb Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Fri, 5 Jan 2024 06:33:07 +0530 Subject: [PATCH 4/4] TEST: Update reference tests --- ...{asr-array_01-1c98579.json => asr-array_01-3a6d424.json} | 6 +++--- ...-array_01-1c98579.stdout => asr-array_01-3a6d424.stdout} | 0 ...{asr-array_02-038b0ce.json => asr-array_02-029184c.json} | 6 +++--- ...-array_02-038b0ce.stdout => asr-array_02-029184c.stdout} | 0 ...{asr-array_04-be6ac8a.json => asr-array_04-b483094.json} | 6 +++--- ...-array_04-be6ac8a.stdout => asr-array_04-b483094.stdout} | 0 .../{asr-expr2-e32c683.json => asr-expr2-5a54418.json} | 6 +++--- .../{asr-expr2-e32c683.stdout => asr-expr2-5a54418.stdout} | 0 .../{asr-test-63dd31d.json => asr-test-43e25d9.json} | 6 +++--- .../{asr-test-63dd31d.stdout => asr-test-43e25d9.stdout} | 0 10 files changed, 15 insertions(+), 15 deletions(-) rename tests/reference/{asr-array_01-1c98579.json => asr-array_01-3a6d424.json} (69%) rename tests/reference/{asr-array_01-1c98579.stdout => asr-array_01-3a6d424.stdout} (100%) rename tests/reference/{asr-array_02-038b0ce.json => asr-array_02-029184c.json} (69%) rename tests/reference/{asr-array_02-038b0ce.stdout => asr-array_02-029184c.stdout} (100%) rename tests/reference/{asr-array_04-be6ac8a.json => asr-array_04-b483094.json} (69%) rename tests/reference/{asr-array_04-be6ac8a.stdout => asr-array_04-b483094.stdout} (100%) rename tests/reference/{asr-expr2-e32c683.json => asr-expr2-5a54418.json} (68%) rename tests/reference/{asr-expr2-e32c683.stdout => asr-expr2-5a54418.stdout} (100%) rename tests/reference/{asr-test-63dd31d.json => asr-test-43e25d9.json} (69%) rename tests/reference/{asr-test-63dd31d.stdout => asr-test-43e25d9.stdout} (100%) diff --git a/tests/reference/asr-array_01-1c98579.json b/tests/reference/asr-array_01-3a6d424.json similarity index 69% rename from tests/reference/asr-array_01-1c98579.json rename to tests/reference/asr-array_01-3a6d424.json index 0f81fee..d6ed94f 100644 --- a/tests/reference/asr-array_01-1c98579.json +++ b/tests/reference/asr-array_01-3a6d424.json @@ -1,11 +1,11 @@ { - "basename": "asr-array_01-1c98579", - "cmd": "lc --asr-dump --no-color {infile} -o {outfile} -extra-arg=\"\"", + "basename": "asr-array_01-3a6d424", + "cmd": "lc --show-asr --no-color {infile} -o {outfile} -extra-arg=\"\"", "infile": "tests/../integration_tests/array_01.cpp", "infile_hash": "deb860e61919d1bd2fbc7abeeed41124193f4284de0838d4ba94fa09", "outfile": null, "outfile_hash": null, - "stdout": "asr-array_01-1c98579.stdout", + "stdout": "asr-array_01-3a6d424.stdout", "stdout_hash": "337b11bab91bf64e841d76a62768573e77f7b5b2db440edef9ad10e7", "stderr": null, "stderr_hash": null, diff --git a/tests/reference/asr-array_01-1c98579.stdout b/tests/reference/asr-array_01-3a6d424.stdout similarity index 100% rename from tests/reference/asr-array_01-1c98579.stdout rename to tests/reference/asr-array_01-3a6d424.stdout diff --git a/tests/reference/asr-array_02-038b0ce.json b/tests/reference/asr-array_02-029184c.json similarity index 69% rename from tests/reference/asr-array_02-038b0ce.json rename to tests/reference/asr-array_02-029184c.json index bfb37a5..87b66c6 100644 --- a/tests/reference/asr-array_02-038b0ce.json +++ b/tests/reference/asr-array_02-029184c.json @@ -1,11 +1,11 @@ { - "basename": "asr-array_02-038b0ce", - "cmd": "lc --asr-dump --no-color {infile} -o {outfile} -extra-arg=\"\"", + "basename": "asr-array_02-029184c", + "cmd": "lc --show-asr --no-color {infile} -o {outfile} -extra-arg=\"\"", "infile": "tests/../integration_tests/array_02.cpp", "infile_hash": "cb968d294be0d86c0f49b3364b7a3aa45b53edcc59349301d5f298ed", "outfile": null, "outfile_hash": null, - "stdout": "asr-array_02-038b0ce.stdout", + "stdout": "asr-array_02-029184c.stdout", "stdout_hash": "be1e2e3174f008918af1f48265f78ff96e7fe5bd39cb3331be787e64", "stderr": null, "stderr_hash": null, diff --git a/tests/reference/asr-array_02-038b0ce.stdout b/tests/reference/asr-array_02-029184c.stdout similarity index 100% rename from tests/reference/asr-array_02-038b0ce.stdout rename to tests/reference/asr-array_02-029184c.stdout diff --git a/tests/reference/asr-array_04-be6ac8a.json b/tests/reference/asr-array_04-b483094.json similarity index 69% rename from tests/reference/asr-array_04-be6ac8a.json rename to tests/reference/asr-array_04-b483094.json index 7f8f71e..54c115d 100644 --- a/tests/reference/asr-array_04-be6ac8a.json +++ b/tests/reference/asr-array_04-b483094.json @@ -1,11 +1,11 @@ { - "basename": "asr-array_04-be6ac8a", - "cmd": "lc --asr-dump --no-color {infile} -o {outfile} -extra-arg=\"\"", + "basename": "asr-array_04-b483094", + "cmd": "lc --show-asr --no-color {infile} -o {outfile} -extra-arg=\"\"", "infile": "tests/../integration_tests/array_04.cpp", "infile_hash": "dd38786061d4a19743e4c32c2a3ecb08193777f81a2a0d3e87af0f0a", "outfile": null, "outfile_hash": null, - "stdout": "asr-array_04-be6ac8a.stdout", + "stdout": "asr-array_04-b483094.stdout", "stdout_hash": "527842cbdfdfac8d3cf494d61c760428aa51ec431fcf2b3e5d2827cd", "stderr": null, "stderr_hash": null, diff --git a/tests/reference/asr-array_04-be6ac8a.stdout b/tests/reference/asr-array_04-b483094.stdout similarity index 100% rename from tests/reference/asr-array_04-be6ac8a.stdout rename to tests/reference/asr-array_04-b483094.stdout diff --git a/tests/reference/asr-expr2-e32c683.json b/tests/reference/asr-expr2-5a54418.json similarity index 68% rename from tests/reference/asr-expr2-e32c683.json rename to tests/reference/asr-expr2-5a54418.json index 8a2e9ab..d33e83d 100644 --- a/tests/reference/asr-expr2-e32c683.json +++ b/tests/reference/asr-expr2-5a54418.json @@ -1,11 +1,11 @@ { - "basename": "asr-expr2-e32c683", - "cmd": "lc --asr-dump --no-color {infile} -o {outfile} -extra-arg=\"\"", + "basename": "asr-expr2-5a54418", + "cmd": "lc --show-asr --no-color {infile} -o {outfile} -extra-arg=\"\"", "infile": "tests/expr2.c", "infile_hash": "11cb114715d67a4763454167abc900089b2119ecf18a980d18a30322", "outfile": null, "outfile_hash": null, - "stdout": "asr-expr2-e32c683.stdout", + "stdout": "asr-expr2-5a54418.stdout", "stdout_hash": "cdcd7c21f44822aca31bc8f5901b18bab75a9c340ad0c17b70ec12fa", "stderr": null, "stderr_hash": null, diff --git a/tests/reference/asr-expr2-e32c683.stdout b/tests/reference/asr-expr2-5a54418.stdout similarity index 100% rename from tests/reference/asr-expr2-e32c683.stdout rename to tests/reference/asr-expr2-5a54418.stdout diff --git a/tests/reference/asr-test-63dd31d.json b/tests/reference/asr-test-43e25d9.json similarity index 69% rename from tests/reference/asr-test-63dd31d.json rename to tests/reference/asr-test-43e25d9.json index 9cc906c..810b335 100644 --- a/tests/reference/asr-test-63dd31d.json +++ b/tests/reference/asr-test-43e25d9.json @@ -1,11 +1,11 @@ { - "basename": "asr-test-63dd31d", - "cmd": "lc --asr-dump --no-color {infile} -o {outfile} -extra-arg=\"\"", + "basename": "asr-test-43e25d9", + "cmd": "lc --show-asr --no-color {infile} -o {outfile} -extra-arg=\"\"", "infile": "tests/test.cpp", "infile_hash": "9e5ef4c37b7e9e1f13f0082ce65459c1e596430887537eb8fd656b77", "outfile": null, "outfile_hash": null, - "stdout": "asr-test-63dd31d.stdout", + "stdout": "asr-test-43e25d9.stdout", "stdout_hash": "f31a3fab00e8917eaae30983c0ed97a62e13a54b839a6439e6e7b225", "stderr": null, "stderr_hash": null, diff --git a/tests/reference/asr-test-63dd31d.stdout b/tests/reference/asr-test-43e25d9.stdout similarity index 100% rename from tests/reference/asr-test-63dd31d.stdout rename to tests/reference/asr-test-43e25d9.stdout