[llvm-branch-commits] [flang] fa1e543 - [flang][driver] Update error messages (nfc)

Andrzej Warzynski via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 6 02:46:31 PST 2021


Author: Andrzej Warzynski
Date: 2021-01-06T10:41:27Z
New Revision: fa1e543e0b8c625bf2625598d9a16c484e349884

URL: https://github.com/llvm/llvm-project/commit/fa1e543e0b8c625bf2625598d9a16c484e349884
DIFF: https://github.com/llvm/llvm-project/commit/fa1e543e0b8c625bf2625598d9a16c484e349884.diff

LOG: [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.

Added: 
    

Modified: 
    flang/lib/Frontend/FrontendAction.cpp
    flang/lib/Frontend/FrontendActions.cpp
    flang/test/Flang-Driver/parse-error.f95
    flang/test/Flang-Driver/scanning-error.f95
    flang/test/Flang-Driver/syntax-only.f90
    flang/tools/f18/f18.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Frontend/FrontendAction.cpp b/flang/lib/Frontend/FrontendAction.cpp
index 4972669bec87..4d8a9d43d114 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 fe21fc5e3d2e..acb9988611e6 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 34af7e2d2ed6..84a63665659d 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 5fcf89d569c1..dbbd222def08 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 4b435e779d56..f04dd713aeab 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 b0cc2298005e..8b7cc099bac1 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);


        


More information about the llvm-branch-commits mailing list