[flang-commits] [flang] 499f1ed - [flang][driver] Fine-tune `-fdebug-dump-symbols`
Andrzej Warzynski via flang-commits
flang-commits at lists.llvm.org
Mon Apr 26 02:21:14 PDT 2021
Author: Andrzej Warzynski
Date: 2021-04-26T09:20:50Z
New Revision: 499f1ed5485383e8e7bf3aacbc6d34560d0668df
URL: https://github.com/llvm/llvm-project/commit/499f1ed5485383e8e7bf3aacbc6d34560d0668df
DIFF: https://github.com/llvm/llvm-project/commit/499f1ed5485383e8e7bf3aacbc6d34560d0668df.diff
LOG: [flang][driver] Fine-tune `-fdebug-dump-symbols`
When generating output for `-fdebug-dump-symbols`, make sure that
BuildRuntimeDerivedTypeTables is also run. This change is needed in
order to make the implementation of `-fdebug-dump-symbols` in
`flang-new` consistent with `f18`. It also allows us to port more tests
to use the new driver whenever it is enabled.
Differential Revision: https://reviews.llvm.org/D100649
Added:
Modified:
flang/lib/Frontend/FrontendActions.cpp
flang/test/Semantics/typeinfo01.f90
Removed:
################################################################################
diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index f35ee4ed58e6..96aa91a2fa92 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -50,7 +50,6 @@ bool PrescanAction::BeginSourceFileAction(CompilerInstance &c1) {
std::string currentInputPath{GetCurrentFileOrBufferName()};
Fortran::parser::Options parserOptions = ci.invocation().fortranOpts();
-
// Prescan. In case of failure, report and return.
ci.parsing().Prescan(currentInputPath, parserOptions);
@@ -283,13 +282,27 @@ void DebugUnparseWithSymbolsAction::ExecuteAction() {
}
void DebugDumpSymbolsAction::ExecuteAction() {
+ CompilerInstance &ci = this->instance();
auto &semantics = this->semantics();
- // Dump symbols
- semantics.DumpSymbols(llvm::outs());
- // Report fatal semantic errors
+ auto tables{Fortran::semantics::BuildRuntimeDerivedTypeTables(
+ instance().invocation().semanticsContext())};
+ // The runtime derived type information table builder may find and report
+ // semantic errors. So it is important that we report them _after_
+ // BuildRuntimeDerivedTypeTables is run.
reportFatalSemanticErrors(
semantics, this->instance().diagnostics(), GetCurrentFileOrBufferName());
+
+ if (!tables.schemata) {
+ unsigned DiagID =
+ ci.diagnostics().getCustomDiagID(clang::DiagnosticsEngine::Error,
+ "could not find module file for __fortran_type_info");
+ ci.diagnostics().Report(DiagID);
+ llvm::errs() << "\n";
+ }
+
+ // Dump symbols
+ semantics.DumpSymbols(llvm::outs());
}
void DebugDumpParseTreeNoSemaAction::ExecuteAction() {
diff --git a/flang/test/Semantics/typeinfo01.f90 b/flang/test/Semantics/typeinfo01.f90
index 6cec91d167cd..740c1bd47be2 100644
--- a/flang/test/Semantics/typeinfo01.f90
+++ b/flang/test/Semantics/typeinfo01.f90
@@ -1,4 +1,4 @@
-!RUN: %f18 -fdebug-dump-symbols %s | FileCheck %s
+!RUN: %flang_fc1 -fdebug-dump-symbols %s | FileCheck %s
! Tests for derived type runtime descriptions
module m01
More information about the flang-commits
mailing list