[PATCH] D95220: [flang][driver] Report prescanning diags during syntax-only parsing
Faris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 22 04:26:56 PST 2021
FarisRehman created this revision.
Herald added a reviewer: sscalpone.
FarisRehman requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Ensure diagnostics from the prescanner are reported when running `flang-new -fsyntax-only` (i.e. only syntax parsing).
This keeps the diagnostics output of flang-new consistent with f18 when running the syntax parsing action, ParseSyntaxOnlyAction.
Summary of changes:
- Modify ParseSyntaxOnlyAction::ExecuteAction to report diagnostics
Repository:
rG LLVM Github Monorepo
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
===================================================================
--- flang/test/Frontend/prescanner-diag.f90
+++ flang/test/Frontend/prescanner-diag.f90
@@ -1,11 +1,13 @@
! 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 -fsyntax-only -I %S/Inputs/ %s 2>&1 | FileCheck %s
! RUN: %flang-new -fc1 -E -I %S/Inputs/ %s 2>&1 | FileCheck %s
+! RUN: %flang-new -fc1 -fsyntax-only -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
+! CHECK: prescanner-diag.f90:10: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
+! CHECK: prescanner-diag.f90:12: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.318483.patch
Type: text/x-patch
Size: 1496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210122/015836fb/attachment.bin>
More information about the llvm-commits
mailing list