[llvm] [IR] Remove an unnecessary cast (NFC) (PR #146381)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 09:16:43 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

C is already of unsigned char.


---
Full diff: https://github.com/llvm/llvm-project/pull/146381.diff


1 Files Affected:

- (modified) llvm/lib/IR/AsmWriter.cpp (+1-2) 


``````````diff
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index ff45afe399c82..af268b4fc6941 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -447,8 +447,7 @@ void llvm::printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name) {
       // in the range 0-255.  This is important when building with MSVC because
       // its implementation will assert.  This situation can arise when dealing
       // with UTF-8 multibyte characters.
-      if (!isalnum(static_cast<unsigned char>(C)) && C != '-' && C != '.' &&
-          C != '_') {
+      if (!isalnum(C) && C != '-' && C != '.' && C != '_') {
         NeedsQuotes = true;
         break;
       }

``````````

</details>


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


More information about the llvm-commits mailing list