[PATCH] D95220: [flang][driver] Report prescanning diags during syntax-only parsing
Faris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 27 02:28:01 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa8f51ea2120b: [flang][driver] Report prescanning diags during syntax-only parsing (authored by FarisRehman).
Changed prior to commit:
https://reviews.llvm.org/D95220?vs=318983&id=319508#toc
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.
+
+! Test with -E (i.e. PrintPreprocessedAction, stops after prescanning)
+! 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 with -fsyntax-only (i.e. ParseSyntaxOnlyAction, stops after semantic checks)
+! 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.319508.patch
Type: text/x-patch
Size: 2251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210127/61cc5586/attachment.bin>
More information about the llvm-commits
mailing list