diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp --- a/flang/lib/Frontend/FrontendActions.cpp +++ b/flang/lib/Frontend/FrontendActions.cpp @@ -49,7 +49,6 @@ std::string currentInputPath{GetCurrentFileOrBufferName()}; Fortran::parser::Options parserOptions = ci.invocation().fortranOpts(); - // Prescan. In case of failure, report and return. ci.parsing().Prescan(currentInputPath, parserOptions); @@ -282,13 +281,29 @@ } void DebugDumpSymbolsAction::ExecuteAction() { + CompilerInstance &ci = this->instance(); auto &semantics = this->semantics(); - // Dump symbols - semantics.DumpSymbols(llvm::outs()); - // Report fatal semantic errors + // Report fatal semantic errors. + // TODO: BuildRuntimeDerivedTypeTables might generate more semantics errors, + // which we should report. However, due to + // https://bugs.llvm.org/show_bug.cgi?id=50040, we can't. Update this once + // 50040 is fixed. reportFatalSemanticErrors( semantics, this->instance().diagnostics(), GetCurrentFileOrBufferName()); + + auto tables{Fortran::semantics::BuildRuntimeDerivedTypeTables( + instance().invocation().semanticsContext())}; + 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 --- 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