[flang][driver] Update error messages (nfc)
authorAndrzej Warzynski <andrzej.warzynski@arm.com>
Wed, 6 Jan 2021 10:35:00 +0000 (10:35 +0000)
committerAndrzej Warzynski <andrzej.warzynski@arm.com>
Wed, 6 Jan 2021 10:41:27 +0000 (10:41 +0000)
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
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

index 4972669..4d8a9d4 100644 (file)
@@ -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());
 
index fe21fc5..acb9988 100644 (file)
@@ -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();
   }
 }
index 34af7e2..84a6366 100644 (file)
@@ -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"
index 5fcf89d..dbbd222 100644 (file)
@@ -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
index 4b435e7..f04dd71 100644 (file)
@@ -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
index b0cc229..8b7cc09 100644 (file)
@@ -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);