[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
Wed Jan 20 09:24:30 PST 2021
awarzynski updated this revision to Diff 317902.
awarzynski added a comment.
Address PR comments
- Added filename in the test, thank you @kiranchandramohan !
- Updated the check prefix in the test, thank you @sameeranjoshi !
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.317902.patch
Type: text/x-patch
Size: 1264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210120/e2477908/attachment.bin>
More information about the llvm-commits
mailing list