Skip to content

Commit

Permalink
Merge pull request #55 from Shaikh-Ubaid/rename_dump_ast_asr
Browse files Browse the repository at this point in the history
Rename `--ast-dump`, `--asr-dump` to  `--show-ast`, `--show-asr`
  • Loading branch information
certik authored Jan 9, 2024
2 parents ad50b6e + f0abe53 commit 9c855f9
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ 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)

if asr:
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)

Expand Down
12 changes: 6 additions & 6 deletions src/bin/lc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ using namespace llvm;
static cl::OptionCategory ClangCheckCategory("clang-check options");
static const opt::OptTable &Options = getDriverOptTable();

static cl::opt<bool> ASTDump("ast-dump",
cl::desc(Options.getOptionHelpText(options::OPT_ast_dump)), cl::cat(ClangCheckCategory));
static cl::opt<std::string> ASTDumpFile("ast-dump-file",
cl::desc("dump the AST output in the specified file"), cl::cat(ClangCheckCategory));
static cl::opt<bool> ASTList("ast-list",
Expand All @@ -47,7 +45,9 @@ static cl::opt<std::string> ASTDumpFilter("ast-dump-filter",

// LC options
static cl::opt<bool>
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<bool>
ShowASR("show-asr", cl::desc("dump the ASR"), cl::cat(ClangCheckCategory));
static cl::opt<bool>
NoIndent("no-indent", cl::desc("do not indent output"), cl::cat(ClangCheckCategory));
static cl::opt<bool>
Expand Down Expand Up @@ -132,7 +132,7 @@ class ClangCheckActionFactory {
std::unique_ptr<clang::ASTConsumer> 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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
File renamed without changes.

0 comments on commit 9c855f9

Please sign in to comment.