[PATCH] D95220: [flang][driver] Report prescanning diags during syntax-only parsing

Faris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 06:16:48 PST 2021


FarisRehman updated this revision to Diff 318983.
FarisRehman added a comment.

Add f18 RUN line

Address review comment by @awarzynski

Summary of changes:

- Add a RUN line for `f18 -fparse-only` to the regression test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95220

Files:
  flang/lib/Frontend/FrontendActions.cpp
  flang/test/Frontend/preprocessor-diag.f90
  flang/test/Frontend/prescanner-diag.f90


Index: flang/test/Frontend/prescanner-diag.f90
===================================================================
--- /dev/null
+++ flang/test/Frontend/prescanner-diag.f90
@@ -0,0 +1,17 @@
+! Test that the driver correctly reports diagnostics from the prescanner. The contents of the include file are irrelevant here.
+
+! Preprocessor action
+! RUN: %f18 -E -I %S/Inputs/ %s 2>&1 | FileCheck %s
+! RUN: %flang-new -E -I %S/Inputs/ %s 2>&1 | FileCheck %s
+! RUN: %flang-new -fc1 -E -I %S/Inputs/ %s 2>&1 | FileCheck %s
+
+! Parsing action
+! RUN: %f18 -fparse-only -I %S/Inputs/ %s 2>&1 | FileCheck %s
+! RUN: %flang-new -fsyntax-only -I %S/Inputs/ %s 2>&1 | FileCheck %s
+! RUN: %flang-new -fc1 -fsyntax-only -I %S/Inputs/ %s 2>&1 | FileCheck %s
+
+! CHECK: prescanner-diag.f90:14:20: #include: extra stuff ignored after file name
+#include <empty.h> comment
+! CHECK: prescanner-diag.f90:16:20: #include: extra stuff ignored after file name
+#include "empty.h" comment
+end
Index: flang/test/Frontend/preprocessor-diag.f90
===================================================================
--- flang/test/Frontend/preprocessor-diag.f90
+++ /dev/null
@@ -1,11 +0,0 @@
-! RUN: %f18 -E -I %S/Inputs/ %s 2>&1 | FileCheck %s
-! RUN: %flang-new -E -I %S/Inputs/ %s 2>&1 | FileCheck %s
-! RUN: %flang-new -fc1 -E -I %S/Inputs/ %s 2>&1 | FileCheck %s
-
-! Test that the driver correctly reports diagnostics from the prescanner. The contents of the include file are irrelevant here.
-
-! CHECK: preprocessor-diag.f90:8:20: #include: extra stuff ignored after file name
-#include <empty.h> comment
-! CHECK: preprocessor-diag.f90:10:20: #include: extra stuff ignored after file name
-#include "empty.h" comment
-end
Index: flang/lib/Frontend/FrontendActions.cpp
===================================================================
--- flang/lib/Frontend/FrontendActions.cpp
+++ flang/lib/Frontend/FrontendActions.cpp
@@ -94,6 +94,9 @@
     return;
   }
 
+  // Report the diagnostics from parsing
+  ci.parsing().messages().Emit(llvm::errs(), ci.allCookedSources());
+
   auto &parseTree{*ci.parsing().parseTree()};
 
   // Prepare semantics


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95220.318983.patch
Type: text/x-patch
Size: 2135 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210125/8bac529f/attachment.bin>


More information about the llvm-commits mailing list