This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGeefda605fe17: [flang][driver] Add support for `-fget-symbols-sources` (authored by awarzynski).
Changed prior to commit: https://reviews.llvm.org/D98191?vs=330978&id=331557#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98191/new/ https://reviews.llvm.org/D98191 Files: clang/include/clang/Driver/Options.td flang/include/flang/Frontend/FrontendActions.h flang/include/flang/Frontend/FrontendOptions.h flang/lib/Frontend/CompilerInvocation.cpp flang/lib/Frontend/FrontendActions.cpp flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp flang/test/Driver/driver-help.f90 flang/test/Semantics/getsymbols01.f90 flang/test/Semantics/getsymbols02.f90 flang/test/Semantics/getsymbols03-a.f90 flang/test/Semantics/getsymbols04.f90 flang/test/Semantics/getsymbols05.f90
Index: flang/test/Semantics/getsymbols05.f90 =================================================================== --- flang/test/Semantics/getsymbols05.f90 +++ flang/test/Semantics/getsymbols05.f90 @@ -9,7 +9,7 @@ x = y end program -! RUN: %f18 -fget-symbols-sources -fsyntax-only %s 2>&1 | FileCheck %s +! RUN: %flang_fc1 -fsyntax-only -fget-symbols-sources %s 2>&1 | FileCheck %s ! CHECK:x:{{.*}}getsymbols05.f90, 3, 14-15 ! CHECK:x:{{.*}}getsymbols05.f90, 6, 16-17 ! CHECK:y:{{.*}}getsymbols05.f90, 4, 14-15 Index: flang/test/Semantics/getsymbols04.f90 =================================================================== --- flang/test/Semantics/getsymbols04.f90 +++ flang/test/Semantics/getsymbols04.f90 @@ -6,7 +6,7 @@ x = y end program -! RUN: %f18 -fget-symbols-sources -fsyntax-only %s 2>&1 | FileCheck %s +! RUN: %flang_fc1 -fsyntax-only -fget-symbols-sources %s 2>&1 | FileCheck %s ! CHECK:x:{{.*}}getsymbols04.f90, 3, 14-15 ! CHECK:x:{{.*}}getsymbols04.f90, 5, 11-12 ! CHECK:y:{{.*}}getsymbols04.f90, 4, 14-15 Index: flang/test/Semantics/getsymbols03-a.f90 =================================================================== --- flang/test/Semantics/getsymbols03-a.f90 +++ flang/test/Semantics/getsymbols03-a.f90 @@ -7,7 +7,7 @@ x = f end program -! RUN: %f18 -fget-symbols-sources -fsyntax-only %s 2>&1 | FileCheck %s +! RUN: %flang_fc1 -fsyntax-only -fget-symbols-sources %s 2>&1 | FileCheck %s ! CHECK:f:{{.*}}getsymbols03-b.f90, 2, 12-13 ! CHECK:main:{{.*}}getsymbols03-a.f90, 4, 9-13 ! CHECK:mm3:{{.*}}getsymbols03-a.f90, 5, 6-9 Index: flang/test/Semantics/getsymbols02.f90 =================================================================== --- flang/test/Semantics/getsymbols02.f90 +++ flang/test/Semantics/getsymbols02.f90 @@ -7,8 +7,8 @@ i = callget5() ENDPROGRAM -! RUN: %f18 -fsyntax-only %S/Inputs/getsymbols02-a.f90 -! RUN: %f18 -fsyntax-only %S/Inputs/getsymbols02-b.f90 -! RUN: %f18 -fget-symbols-sources -fsyntax-only %s 2>&1 | FileCheck %s +! RUN: %flang_fc1 -fsyntax-only %S/Inputs/getsymbols02-a.f90 +! RUN: %flang_fc1 -fsyntax-only %S/Inputs/getsymbols02-b.f90 +! RUN: %flang_fc1 -fsyntax-only -fget-symbols-sources %s 2>&1 | FileCheck %s ! CHECK: callget5: .{{[/\\]}}mm2b.mod, ! CHECK: get5: .{{[/\\]}}mm2a.mod, Index: flang/test/Semantics/getsymbols01.f90 =================================================================== --- flang/test/Semantics/getsymbols01.f90 +++ flang/test/Semantics/getsymbols01.f90 @@ -15,7 +15,7 @@ end function end module -! RUN: %f18 -fget-symbols-sources -fsyntax-only %s 2>&1 | FileCheck %s +! RUN: %flang_fc1 -fsyntax-only -fget-symbols-sources %s 2>&1 | FileCheck %s ! CHECK-COUNT-1:f:{{.*}}getsymbols01.f90, 12, 26-27 ! CHECK-COUNT-1:mm1:{{.*}}getsymbols01.f90, 2, 8-11 ! CHECK-COUNT-1:s:{{.*}}getsymbols01.f90, 5, 18-19 Index: flang/test/Driver/driver-help.f90 =================================================================== --- flang/test/Driver/driver-help.f90 +++ flang/test/Driver/driver-help.f90 @@ -80,6 +80,7 @@ ! HELP-FC1-NEXT: -ffixed-line-length=<value> ! HELP-FC1-NEXT: Use <value> as character line width in fixed mode ! HELP-FC1-NEXT: -ffree-form Process source files in free form +! HELP-FC1-NEXT: -fget-symbols-sources Dump symbols and their source code locations ! HELP-FC1-NEXT: -fimplicit-none No implicit typing allowed unless overridden by IMPLICIT statements ! HELP-FC1-NEXT: -finput-charset=<value> Specify the default character set for source files ! HELP-FC1-NEXT: -flarge-sizes Use INTEGER(KIND=8) for the result type in size-related intrinsics Index: flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp =================================================================== --- flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -61,6 +61,9 @@ case DebugPreFIRTree: return std::make_unique<DebugPreFIRTreeAction>(); break; + case GetSymbolsSources: + return std::make_unique<GetSymbolsSourcesAction>(); + break; default: break; // TODO: Index: flang/lib/Frontend/FrontendActions.cpp =================================================================== --- flang/lib/Frontend/FrontendActions.cpp +++ flang/lib/Frontend/FrontendActions.cpp @@ -16,6 +16,7 @@ #include "flang/Parser/provenance.h" #include "flang/Parser/source.h" #include "flang/Parser/unparse.h" +#include "flang/Semantics/runtime-type-info.h" #include "flang/Semantics/semantics.h" #include "flang/Semantics/unparse-with-symbols.h" #include "llvm/ADT/StringRef.h" @@ -314,6 +315,15 @@ ci.parsing().DumpParsingLog(llvm::outs()); } +void GetSymbolsSourcesAction::ExecuteAction() { + // Report and exit if fatal semantic errors are present + if (reportFatalSemanticErrors(semantics(), this->instance().diagnostics(), + GetCurrentFileOrBufferName())) + return; + + semantics().DumpSymbolsSources(llvm::outs()); +} + void EmitObjAction::ExecuteAction() { CompilerInstance &ci = this->instance(); unsigned DiagID = ci.diagnostics().getCustomDiagID( Index: flang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- flang/lib/Frontend/CompilerInvocation.cpp +++ flang/lib/Frontend/CompilerInvocation.cpp @@ -143,6 +143,9 @@ case clang::driver::options::OPT_fdebug_pre_fir_tree: opts.programAction_ = DebugPreFIRTree; break; + case clang::driver::options::OPT_fget_symbols_sources: + opts.programAction_ = GetSymbolsSources; + break; // TODO: // case calng::driver::options::OPT_emit_llvm: Index: flang/include/flang/Frontend/FrontendOptions.h =================================================================== --- flang/include/flang/Frontend/FrontendOptions.h +++ flang/include/flang/Frontend/FrontendOptions.h @@ -58,7 +58,10 @@ DebugMeasureParseTree, /// Parse, run semantics and then output the pre-FIR tree - DebugPreFIRTree + DebugPreFIRTree, + + /// Parse, run semantics and then dump symbol sources map + GetSymbolsSources /// TODO: RunPreprocessor, EmitLLVM, EmitLLVMOnly, /// EmitCodeGenOnly, EmitAssembly, (...) Index: flang/include/flang/Frontend/FrontendActions.h =================================================================== --- flang/include/flang/Frontend/FrontendActions.h +++ flang/include/flang/Frontend/FrontendActions.h @@ -100,6 +100,10 @@ void ExecuteAction() override; }; +class GetSymbolsSourcesAction : public PrescanAndSemaAction { + void ExecuteAction() override; +}; + class ParseSyntaxOnlyAction : public PrescanAndSemaAction { void ExecuteAction() override; }; Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -4364,6 +4364,8 @@ HelpText<"Dump the pre-FIR tree">; def fdebug_module_writer : Flag<["-"],"fdebug-module-writer">, HelpText<"Enable debug messages while writing module files">; +def fget_symbols_sources : Flag<["-"], "fget-symbols-sources">, Group<Action_Group>, + HelpText<"Dump symbols and their source code locations">; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits