aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend
diff options
context:
space:
mode:
authorAndre Kuhlenschmidt <andre.kuhlenschmidt@gmail.com>2025-06-30 10:17:05 -0700
committerGitHub <noreply@github.com>2025-06-30 10:17:05 -0700
commit83b462af17ca807d276963b37640a9f2e91d70b1 (patch)
tree432575044febca2535f7ace359e6452a07e34a34 /flang/lib/Frontend
parentefc561c061bc15036f923f5b0b24133be54a6395 (diff)
downloadllvm-83b462af17ca807d276963b37640a9f2e91d70b1.zip
llvm-83b462af17ca807d276963b37640a9f2e91d70b1.tar.gz
llvm-83b462af17ca807d276963b37640a9f2e91d70b1.tar.bz2
[flang][CLI] Have the CLI hint the flag to disable a warning (#144767)
Adds a hint to the warning message to disable a warning and updates the tests to expect this. Also fixes a bug in the storage of canonical spelling of error flags so that they are not used after free.
Diffstat (limited to 'flang/lib/Frontend')
-rw-r--r--flang/lib/Frontend/FrontendAction.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/flang/lib/Frontend/FrontendAction.cpp b/flang/lib/Frontend/FrontendAction.cpp
index d178fd6..5d788fe 100644
--- a/flang/lib/Frontend/FrontendAction.cpp
+++ b/flang/lib/Frontend/FrontendAction.cpp
@@ -171,7 +171,10 @@ bool FrontendAction::runParse(bool emitMessages) {
if (emitMessages) {
// Report any non-fatal diagnostics from getParsing now rather than
// combining them with messages from semantics.
- ci.getParsing().messages().Emit(llvm::errs(), ci.getAllCookedSources());
+ const common::LanguageFeatureControl &features{
+ ci.getInvocation().getFortranOpts().features};
+ ci.getParsing().messages().Emit(llvm::errs(), ci.getAllCookedSources(),
+ /*echoSourceLine=*/true, &features);
}
return true;
}
@@ -223,6 +226,8 @@ bool FrontendAction::generateRtTypeTables() {
template <unsigned N>
bool FrontendAction::reportFatalErrors(const char (&message)[N]) {
+ const common::LanguageFeatureControl &features{
+ instance->getInvocation().getFortranOpts().features};
if (!instance->getParsing().messages().empty() &&
(instance->getInvocation().getWarnAsErr() ||
instance->getParsing().messages().AnyFatalError())) {
@@ -230,7 +235,8 @@ bool FrontendAction::reportFatalErrors(const char (&message)[N]) {
clang::DiagnosticsEngine::Error, message);
instance->getDiagnostics().Report(diagID) << getCurrentFileOrBufferName();
instance->getParsing().messages().Emit(llvm::errs(),
- instance->getAllCookedSources());
+ instance->getAllCookedSources(),
+ /*echoSourceLines=*/true, &features);
return true;
}
if (instance->getParsing().parseTree().has_value() &&
@@ -240,7 +246,8 @@ bool FrontendAction::reportFatalErrors(const char (&message)[N]) {
clang::DiagnosticsEngine::Error, message);
instance->getDiagnostics().Report(diagID) << getCurrentFileOrBufferName();
instance->getParsing().messages().Emit(llvm::errs(),
- instance->getAllCookedSources());
+ instance->getAllCookedSources(),
+ /*echoSourceLine=*/true, &features);
instance->getParsing().EmitMessage(
llvm::errs(), instance->getParsing().finalRestingPlace(),
"parser FAIL (final position)", "error: ", llvm::raw_ostream::RED);