Skip to content

Commit

Permalink
Rename --show-ast to --show-clang-ast
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Jan 24, 2024
1 parent ec2ed68 commit e2adeb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: |
export CPATH=$CONDA_PREFIX/include:$CPATH
lc --show-ast tests/test.cpp
lc --show-clang-ast tests/test.cpp
lc examples/expr2.c --show-asr
./run_tests.py
Expand Down
16 changes: 8 additions & 8 deletions src/bin/lc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ class ClangCheckActionFactory {
public:

std::string infile, ast_dump_file, ast_dump_filter;
bool ast_list, ast_print, show_ast;
bool ast_list, ast_print, show_clang_ast;

ClangCheckActionFactory(std::string infile_, std::string ast_dump_file,
std::string ast_dump_filter, bool ast_list,
bool ast_print, bool show_ast): infile(infile_),
bool ast_print, bool show_clang_ast): infile(infile_),
ast_dump_file(ast_dump_file), ast_dump_filter(ast_dump_filter),
ast_list(ast_list), ast_print(ast_print), show_ast(show_ast) {}
ast_list(ast_list), ast_print(ast_print), show_clang_ast(show_clang_ast) {}

std::unique_ptr<clang::ASTConsumer> newASTConsumer() {
if (ast_list) {
return clang::CreateASTDeclNodeLister();
} else if ( show_ast ) {
} else if ( show_clang_ast ) {
llvm::raw_fd_ostream* llvm_fd_ostream = nullptr;
if ( ast_dump_file.size() > 0 ) {
std::error_code errorCode;
Expand Down Expand Up @@ -689,7 +689,7 @@ int mainApp(int argc, const char **argv) {
bool ast_list = false;
bool ast_print = false;
std::string ast_dump_filter = "";
bool show_ast = false;
bool show_clang_ast = false;
bool show_asr = false;
bool arg_no_indent = false;
bool arg_no_color = false;
Expand All @@ -713,7 +713,7 @@ int mainApp(int argc, const char **argv) {
app.add_flag("--ast-print", ast_print, "Build ASTs and then pretty-print them");
app.add_flag("--ast-dump-filter", ast_dump_filter, "Use with -ast-dump or -ast-print to dump/print"
" only AST declaration nodes having a certain substring in a qualified name.");
app.add_flag("--show-ast", show_ast, "Show AST for the given file and exit");
app.add_flag("--show-clang-ast", show_clang_ast, "Show AST for the given file and exit");
app.add_flag("--show-asr", show_asr, "Show ASR for the given file and exit");
app.add_flag("--no-indent", arg_no_indent, "Turn off Indented print ASR/AST");
app.add_flag("--no-color", arg_no_color, "Turn off colored AST/ASR");
Expand Down Expand Up @@ -762,9 +762,9 @@ int mainApp(int argc, const char **argv) {
std::string infile = sourcePaths[0];

// Handle Clang related options in the following
if (show_ast || ast_list || ast_print) {
if (show_clang_ast || ast_list || ast_print) {
ClangCheckActionFactory CheckFactory(infile, ast_dump_file,
ast_dump_filter, ast_list, ast_print, show_ast);
ast_dump_filter, ast_list, ast_print, show_clang_ast);
int status = Tool.run(newFrontendActionFactory(&CheckFactory).get());
return status;
}
Expand Down

0 comments on commit e2adeb3

Please sign in to comment.