[PATCH] D100649: [flang][driver] Fine-tune `-fdebug-dump-symbols`

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 08:55:59 PDT 2021


awarzynski updated this revision to Diff 338886.
awarzynski added a comment.

Remove D100648 <https://reviews.llvm.org/D100648> as a dependency

D100648 <https://reviews.llvm.org/D100648> was abandoned due to https://bugs.llvm.org/show_bug.cgi?id=50040. The latest revision of this patch takes 50040 into account. The behaviour implemented here matches that from `f18`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100649/new/

https://reviews.llvm.org/D100649

Files:
  flang/lib/Frontend/FrontendActions.cpp
  flang/test/Semantics/typeinfo01.f90


Index: flang/test/Semantics/typeinfo01.f90
===================================================================
--- flang/test/Semantics/typeinfo01.f90
+++ 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
Index: flang/lib/Frontend/FrontendActions.cpp
===================================================================
--- flang/lib/Frontend/FrontendActions.cpp
+++ 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() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100649.338886.patch
Type: text/x-patch
Size: 1984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210420/999f9e5e/attachment.bin>


More information about the llvm-commits mailing list