From fa1e543e0b8c625bf2625598d9a16c484e349884 Mon Sep 17 00:00:00 2001 From: Andrzej Warzynski Date: Wed, 6 Jan 2021 10:35:00 +0000 Subject: [PATCH] [flang][driver] Update error messages (nfc) As per Flang's coding guidelines (flang/docs/C++style.md#error-messages): ``` Messages should start with a capital letter. ``` This patch updates error messages in the driver (new and old) so that they conform with the guideline above. This change was suggested in one of the recent reviews: https://reviews.llvm.org/D93712. It felt like this deserved a dedicated patch, so sending it separately. --- flang/lib/Frontend/FrontendAction.cpp | 2 +- flang/lib/Frontend/FrontendActions.cpp | 4 ++-- flang/test/Flang-Driver/parse-error.f95 | 2 +- flang/test/Flang-Driver/scanning-error.f95 | 2 +- flang/test/Flang-Driver/syntax-only.f90 | 2 +- flang/tools/f18/f18.cpp | 8 ++++---- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flang/lib/Frontend/FrontendAction.cpp b/flang/lib/Frontend/FrontendAction.cpp index 4972669..4d8a9d4 100644 --- a/flang/lib/Frontend/FrontendAction.cpp +++ b/flang/lib/Frontend/FrontendAction.cpp @@ -57,7 +57,7 @@ llvm::Error FrontendAction::Execute() { if (ci.parsing().messages().AnyFatalError()) { const unsigned diagID = ci.diagnostics().getCustomDiagID( - clang::DiagnosticsEngine::Error, "could not scan %0"); + clang::DiagnosticsEngine::Error, "Could not scan %0"); ci.diagnostics().Report(diagID) << GetCurrentFileOrBufferName(); ci.parsing().messages().Emit(llvm::errs(), ci.allCookedSources()); diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp index fe21fc5..acb9988 100644 --- a/flang/lib/Frontend/FrontendActions.cpp +++ b/flang/lib/Frontend/FrontendActions.cpp @@ -83,7 +83,7 @@ void ParseSyntaxOnlyAction::ExecuteAction() { if (ci.parsing().messages().AnyFatalError()) { unsigned diagID = ci.diagnostics().getCustomDiagID( - clang::DiagnosticsEngine::Error, "could not parse %0"); + clang::DiagnosticsEngine::Error, "Could not parse %0"); ci.diagnostics().Report(diagID) << GetCurrentFileOrBufferName(); ci.parsing().messages().Emit( @@ -107,7 +107,7 @@ void ParseSyntaxOnlyAction::ExecuteAction() { if (semantics.AnyFatalError()) { unsigned DiagID = ci.diagnostics().getCustomDiagID( - clang::DiagnosticsEngine::Error, "semantic errors in %0"); + clang::DiagnosticsEngine::Error, "Semantic errors in %0"); ci.diagnostics().Report(DiagID) << GetCurrentFileOrBufferName(); } } diff --git a/flang/test/Flang-Driver/parse-error.f95 b/flang/test/Flang-Driver/parse-error.f95 index 34af7e2..84a6366 100644 --- a/flang/test/Flang-Driver/parse-error.f95 +++ b/flang/test/Flang-Driver/parse-error.f95 @@ -3,6 +3,6 @@ ! REQUIRES: new-flang-driver -! ERROR: could not parse {{.*}}parse-error.f95 +! ERROR: Could not parse {{.*}}parse-error.f95 "This file will not parse" diff --git a/flang/test/Flang-Driver/scanning-error.f95 b/flang/test/Flang-Driver/scanning-error.f95 index 5fcf89d..dbbd222 100644 --- a/flang/test/Flang-Driver/scanning-error.f95 +++ b/flang/test/Flang-Driver/scanning-error.f95 @@ -3,6 +3,6 @@ ! REQUIRES: new-flang-driver -! ERROR: could not scan {{.*}}scanning-error.f95 +! ERROR: Could not scan {{.*}}scanning-error.f95 #NOT-PP-DIRECTIVE diff --git a/flang/test/Flang-Driver/syntax-only.f90 b/flang/test/Flang-Driver/syntax-only.f90 index 4b435e7..f04dd71 100644 --- a/flang/test/Flang-Driver/syntax-only.f90 +++ b/flang/test/Flang-Driver/syntax-only.f90 @@ -4,6 +4,6 @@ ! REQUIRES: new-flang-driver ! CHECK: IF statement is not allowed in IF statement -! CHECK: semantic errors in {{.*}}syntax-only.f90 +! CHECK: Semantic errors in {{.*}}syntax-only.f90 IF (A > 0.0) IF (B < 0.0) A = LOG (A) END diff --git a/flang/tools/f18/f18.cpp b/flang/tools/f18/f18.cpp index b0cc229..8b7cc09 100644 --- a/flang/tools/f18/f18.cpp +++ b/flang/tools/f18/f18.cpp @@ -209,7 +209,7 @@ std::string CompileFortran(std::string path, Fortran::parser::Options options, parsing.Prescan(path, options); if (!parsing.messages().empty() && (driver.warningsAreErrors || parsing.messages().AnyFatalError())) { - llvm::errs() << driver.prefix << "could not scan " << path << '\n'; + llvm::errs() << driver.prefix << "Could not scan " << path << '\n'; parsing.messages().Emit(llvm::errs(), allCookedSources); exitStatus = EXIT_FAILURE; return {}; @@ -232,14 +232,14 @@ std::string CompileFortran(std::string path, Fortran::parser::Options options, parsing.messages().Emit(llvm::errs(), allCookedSources); if (!parsing.consumedWholeFile()) { parsing.EmitMessage(llvm::errs(), parsing.finalRestingPlace(), - "parser FAIL (final position)"); + "Parser FAIL (final position)"); exitStatus = EXIT_FAILURE; return {}; } if ((!parsing.messages().empty() && (driver.warningsAreErrors || parsing.messages().AnyFatalError())) || !parsing.parseTree()) { - llvm::errs() << driver.prefix << "could not parse " << path << '\n'; + llvm::errs() << driver.prefix << "Could not parse " << path << '\n'; exitStatus = EXIT_FAILURE; return {}; } @@ -258,7 +258,7 @@ std::string CompileFortran(std::string path, Fortran::parser::Options options, if (driver.dumpSymbols) { semantics.DumpSymbols(llvm::outs()); } - llvm::errs() << driver.prefix << "semantic errors in " << path << '\n'; + llvm::errs() << driver.prefix << "Semantic errors in " << path << '\n'; exitStatus = EXIT_FAILURE; if (driver.dumpParseTree) { Fortran::parser::DumpTree(llvm::outs(), parseTree, &asFortran); -- 2.7.4