Skip to content

Commit 9c855f9

Browse files
authored
Merge pull request #55 from Shaikh-Ubaid/rename_dump_ast_asr
Rename `--ast-dump`, `--asr-dump` to `--show-ast`, `--show-asr`
2 parents ad50b6e + f0abe53 commit 9c855f9

13 files changed

Lines changed: 25 additions & 25 deletions

.github/workflows/CI.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
5252
run: |
5353
export CPATH=$CONDA_PREFIX/include:$CPATH
54-
lc --ast-dump tests/test.cpp
55-
lc examples/expr2.c --asr-dump
54+
lc --show-ast tests/test.cpp
55+
lc examples/expr2.c --show-asr
5656
./run_tests.py
5757
5858
- name: Test2 (Linux / macOS)

run_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ def is_included(backend):
4848
run_test(
4949
filename,
5050
"ast",
51-
"lc --ast-dump {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"',
51+
"lc --show-ast {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"',
5252
filename,
5353
update_reference, extra_args)
5454

5555
if asr:
5656
run_test(
5757
filename,
5858
"asr",
59-
"lc --asr-dump --no-color {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"',
59+
"lc --show-asr --no-color {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"',
6060
filename,
6161
update_reference, extra_args)
6262

src/bin/lc.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ using namespace llvm;
3434
static cl::OptionCategory ClangCheckCategory("clang-check options");
3535
static const opt::OptTable &Options = getDriverOptTable();
3636

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

4846
// LC options
4947
static cl::opt<bool>
50-
ASRDump("asr-dump", cl::desc("dump the ASR"), cl::cat(ClangCheckCategory));
48+
ShowAST("show-ast", cl::desc("dump the AST"), cl::cat(ClangCheckCategory));
49+
static cl::opt<bool>
50+
ShowASR("show-asr", cl::desc("dump the ASR"), cl::cat(ClangCheckCategory));
5151
static cl::opt<bool>
5252
NoIndent("no-indent", cl::desc("do not indent output"), cl::cat(ClangCheckCategory));
5353
static cl::opt<bool>
@@ -132,7 +132,7 @@ class ClangCheckActionFactory {
132132
std::unique_ptr<clang::ASTConsumer> newASTConsumer() {
133133
if (ASTList) {
134134
return clang::CreateASTDeclNodeLister();
135-
} else if ( ASTDump ) {
135+
} else if ( ShowAST ) {
136136
llvm::raw_fd_ostream* llvm_fd_ostream = nullptr;
137137
if( ASTDumpFile.size() > 0 ) {
138138
std::error_code errorCode;
@@ -732,7 +732,7 @@ int main(int argc, const char **argv) {
732732
std::string infile = sourcePaths[0];
733733

734734
// Handle Clang related options in the following
735-
if (ASTDump || ASTList || ASTPrint) {
735+
if (ShowAST || ASTList || ASTPrint) {
736736
ClangCheckActionFactory CheckFactory(infile);
737737
int status = Tool.run(newFrontendActionFactory(&CheckFactory).get());
738738
return status;
@@ -748,7 +748,7 @@ int main(int argc, const char **argv) {
748748
return status;
749749
}
750750

751-
if (ASRDump) {
751+
if (ShowASR) {
752752
bool indent = !NoIndent, color = !NoColor;
753753
std::cout<< LCompilers::pickle(*tu, color, indent, true) << std::endl;
754754
return 0;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"basename": "asr-array_01-1c98579",
3-
"cmd": "lc --asr-dump --no-color {infile} -o {outfile} -extra-arg=\"\"",
2+
"basename": "asr-array_01-3a6d424",
3+
"cmd": "lc --show-asr --no-color {infile} -o {outfile} -extra-arg=\"\"",
44
"infile": "tests/../integration_tests/array_01.cpp",
55
"infile_hash": "deb860e61919d1bd2fbc7abeeed41124193f4284de0838d4ba94fa09",
66
"outfile": null,
77
"outfile_hash": null,
8-
"stdout": "asr-array_01-1c98579.stdout",
8+
"stdout": "asr-array_01-3a6d424.stdout",
99
"stdout_hash": "337b11bab91bf64e841d76a62768573e77f7b5b2db440edef9ad10e7",
1010
"stderr": null,
1111
"stderr_hash": null,
File renamed without changes.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"basename": "asr-array_02-038b0ce",
3-
"cmd": "lc --asr-dump --no-color {infile} -o {outfile} -extra-arg=\"\"",
2+
"basename": "asr-array_02-029184c",
3+
"cmd": "lc --show-asr --no-color {infile} -o {outfile} -extra-arg=\"\"",
44
"infile": "tests/../integration_tests/array_02.cpp",
55
"infile_hash": "cb968d294be0d86c0f49b3364b7a3aa45b53edcc59349301d5f298ed",
66
"outfile": null,
77
"outfile_hash": null,
8-
"stdout": "asr-array_02-038b0ce.stdout",
8+
"stdout": "asr-array_02-029184c.stdout",
99
"stdout_hash": "be1e2e3174f008918af1f48265f78ff96e7fe5bd39cb3331be787e64",
1010
"stderr": null,
1111
"stderr_hash": null,
File renamed without changes.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"basename": "asr-array_04-be6ac8a",
3-
"cmd": "lc --asr-dump --no-color {infile} -o {outfile} -extra-arg=\"\"",
2+
"basename": "asr-array_04-b483094",
3+
"cmd": "lc --show-asr --no-color {infile} -o {outfile} -extra-arg=\"\"",
44
"infile": "tests/../integration_tests/array_04.cpp",
55
"infile_hash": "dd38786061d4a19743e4c32c2a3ecb08193777f81a2a0d3e87af0f0a",
66
"outfile": null,
77
"outfile_hash": null,
8-
"stdout": "asr-array_04-be6ac8a.stdout",
8+
"stdout": "asr-array_04-b483094.stdout",
99
"stdout_hash": "527842cbdfdfac8d3cf494d61c760428aa51ec431fcf2b3e5d2827cd",
1010
"stderr": null,
1111
"stderr_hash": null,
File renamed without changes.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"basename": "asr-expr2-e32c683",
3-
"cmd": "lc --asr-dump --no-color {infile} -o {outfile} -extra-arg=\"\"",
2+
"basename": "asr-expr2-5a54418",
3+
"cmd": "lc --show-asr --no-color {infile} -o {outfile} -extra-arg=\"\"",
44
"infile": "tests/expr2.c",
55
"infile_hash": "11cb114715d67a4763454167abc900089b2119ecf18a980d18a30322",
66
"outfile": null,
77
"outfile_hash": null,
8-
"stdout": "asr-expr2-e32c683.stdout",
8+
"stdout": "asr-expr2-5a54418.stdout",
99
"stdout_hash": "cdcd7c21f44822aca31bc8f5901b18bab75a9c340ad0c17b70ec12fa",
1010
"stderr": null,
1111
"stderr_hash": null,

0 commit comments

Comments
 (0)