[PATCH] D148601: [Clang] Handle Error message to output proper Prefix

Usman Akinyemi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 25 05:50:25 PDT 2023


Unique_Usman updated this revision to Diff 516762.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148601/new/

https://reviews.llvm.org/D148601

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp


Index: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
===================================================================
--- clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -1095,7 +1095,8 @@
     // Produce an error if no expected-* directives could be found in the
     // source file(s) processed.
     if (Status == HasNoDirectives) {
-      Diags.Report(diag::err_verify_no_directives).setForceEmit();
+      const auto &Prefixes = Diags.getDiagnosticOptions().VerifyPrefixes;
+      Diags.Report(diag::err_verify_no_directives).setForceEmit() << *Prefixes.begin();
       ++NumErrors;
       Status = HasNoDirectivesReported;
     }
Index: clang/include/clang/Basic/DiagnosticFrontendKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticFrontendKinds.td
+++ clang/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -175,7 +175,7 @@
     "%select{expected|'expected-no-diagnostics'}0 directive cannot follow "
     "%select{'expected-no-diagnostics' directive|other expected directives}0">;
 def err_verify_no_directives : Error<
-    "no expected directives found: consider use of 'expected-no-diagnostics'">;
+    "no expected directives found: consider use of '%0-no-diagnostics'">;
 def err_verify_nonconst_addrspace : Error<
   "qualifier 'const' is needed for variables in address space '%0'">;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148601.516762.patch
Type: text/x-patch
Size: 1428 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230425/32757b8f/attachment.bin>


More information about the cfe-commits mailing list