[clang] [Clang] Do not warn on UTF-16 -> UTF-32 conversions. (PR #163927)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 17 01:53:24 PDT 2025


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 -- clang/lib/Sema/SemaChecking.cpp clang/test/SemaCXX/warn-implicit-unicode-conversions.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/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 26d56cc21..06da07877 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -12313,8 +12313,8 @@ static void DiagnoseMixedUnicodeImplicitConversion(Sema &S, const Type *Source,
   // Lone surrogates have a distinct representation in UTF-32.
   // Converting betweem UTF-16 and UTF-32 codepoint seems very widespread,
   // so don't warn on such conversion.
-  if(Source->isChar16Type() && Target->isChar32Type())
-      return;
+  if (Source->isChar16Type() && Target->isChar32Type())
+    return;
 
   Expr::EvalResult Result;
   if (E->EvaluateAsInt(Result, S.getASTContext(), Expr::SE_AllowSideEffects,

``````````

</details>


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


More information about the cfe-commits mailing list