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

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 16 07:42:47 PDT 2021


awarzynski created this revision.
Herald added a reviewer: sscalpone.
awarzynski requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100649

Files:
  flang/lib/Frontend/FrontendActions.cpp
  flang/test/Semantics/data05.f90
  flang/test/Semantics/offsets01.f90
  flang/test/Semantics/offsets02.f90
  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: not %f18 -fdebug-dump-symbols %s | FileCheck %s
+!RUN: not %flang_fc1 -fdebug-dump-symbols %s | FileCheck %s
 ! Tests for derived type runtime descriptions
 
 module m01
Index: flang/test/Semantics/offsets02.f90
===================================================================
--- flang/test/Semantics/offsets02.f90
+++ flang/test/Semantics/offsets02.f90
@@ -1,4 +1,4 @@
-!RUN: not %f18 -fdebug-dump-symbols %s | FileCheck %s
+!RUN: not %flang_fc1 -fdebug-dump-symbols %s | FileCheck %s
 
 ! Size and alignment of derived types
 
Index: flang/test/Semantics/offsets01.f90
===================================================================
--- flang/test/Semantics/offsets01.f90
+++ flang/test/Semantics/offsets01.f90
@@ -1,4 +1,4 @@
-!RUN: not %f18 -fdebug-dump-symbols %s | FileCheck %s
+!RUN: not %flang_fc1 -fdebug-dump-symbols %s | FileCheck %s
 
 ! Size and alignment of intrinsic types
 subroutine s1
Index: flang/test/Semantics/data05.f90
===================================================================
--- flang/test/Semantics/data05.f90
+++ flang/test/Semantics/data05.f90
@@ -1,4 +1,4 @@
-!RUN: not %f18 -fdebug-dump-symbols %s | FileCheck %s
+!RUN: not %flang_fc1 -fdebug-dump-symbols %s | FileCheck %s
 module m
   interface
     integer function ifunc(n)
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,10 +281,22 @@
 }
 
 void DebugDumpSymbolsAction::ExecuteAction() {
+  CompilerInstance &ci = this->instance();
   auto &semantics = this->semantics();
 
+  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());
+
   // Report fatal semantic errors
   reportFatalSemanticErrors(
       semantics, this->instance().diagnostics(), GetCurrentFileOrBufferName());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100649.338112.patch
Type: text/x-patch
Size: 2716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210416/58fba9b0/attachment.bin>


More information about the llvm-commits mailing list