[flang-commits] [clang] [clang-tools-extra] [flang] [lldb] [Clang] Refactor and consolidate color diagnostic handling (PR #202441)

via flang-commits flang-commits at lists.llvm.org
Tue Jun 23 12:00:01 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- clang/test/Misc/diagnostic-color-output-stream.cpp clang-tools-extra/clang-tidy/ClangTidy.cpp clang-tools-extra/clangd/Compiler.cpp clang/include/clang/Basic/DiagnosticOptions.h clang/lib/AST/ASTDumper.cpp clang/lib/Basic/Warnings.cpp clang/lib/Driver/ToolChains/CommonArgs.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/FrontendActions.cpp clang/lib/Frontend/TextDiagnostic.cpp clang/lib/Frontend/TextDiagnosticPrinter.cpp clang/unittests/Tooling/ToolingTest.cpp flang/lib/Frontend/CompilerInvocation.cpp flang/lib/Frontend/TextDiagnosticPrinter.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Basic/Warnings.cpp b/clang/lib/Basic/Warnings.cpp
index c76ef7a59..046cd8d11 100644
--- a/clang/lib/Basic/Warnings.cpp
+++ b/clang/lib/Basic/Warnings.cpp
@@ -56,7 +56,8 @@ void clang::ProcessWarningOptions(DiagnosticsEngine &Diags,
   Diags.setPrintTemplateTree(Opts.ShowTemplateTree);
   // This flag bakes colors into the formatted message (e.g. template diffs), so
   // resolve 'auto' against the default diagnostic stream (stderr) rather than
-  // forcing colors on. This keeps ANSI codes out of redirected or logged output.
+  // forcing colors on. This keeps ANSI codes out of redirected or logged
+  // output.
   Diags.setShowColors(Opts.showColors(llvm::errs().has_colors()));
 
   // Handle -ferror-limit

``````````

</details>


https://github.com/llvm/llvm-project/pull/202441


More information about the flang-commits mailing list