[PATCH] D94782: [flang][driver] Make the driver report diagnostics from the prescanner

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 21 07:18:10 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0eeb15741bda: [flang][driver] Make the driver report diagnostics from the prescanner (authored by awarzynski).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94782

Files:
  flang/lib/Frontend/FrontendActions.cpp
  flang/test/Frontend/Inputs/empty.h
  flang/test/Frontend/preprocessor-diag.f90


Index: flang/test/Frontend/preprocessor-diag.f90
===================================================================
--- /dev/null
+++ flang/test/Frontend/preprocessor-diag.f90
@@ -0,0 +1,11 @@
+! 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
@@ -61,6 +61,9 @@
     return;
   }
 
+  // Print diagnostics from the preprocessor
+  ci.parsing().messages().Emit(llvm::errs(), ci.allCookedSources());
+
   // Create a file and save the preprocessed output there
   if (auto os{ci.CreateDefaultOutputFile(
           /*Binary=*/true, /*InFile=*/GetCurrentFileOrBufferName())}) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94782.318194.patch
Type: text/x-patch
Size: 1264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210121/5d4e8cec/attachment.bin>


More information about the llvm-commits mailing list