[clang] [clang][bytecode][NFC] Avoid an implicit integer conversion (PR #139845)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Tue May 13 22:06:09 PDT 2025


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/139845

getCharByteWidth() returns an unsigned.

>From 4fa9f128a32eb30865cbf760c13091b6804a87c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Wed, 14 May 2025 06:57:39 +0200
Subject: [PATCH] [clang][bytecode][NFC] Avoid an implicit integer conversion

getCharByteWidth() returns an unsigned.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index c7fb5e8466686..5fee6f3bc01a8 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -2435,7 +2435,7 @@ bool Compiler<Emitter>::VisitStringLiteral(const StringLiteral *E) {
   // emitted. Read only the array length from the string literal.
   unsigned ArraySize = CAT->getZExtSize();
   unsigned N = std::min(ArraySize, E->getLength());
-  size_t CharWidth = E->getCharByteWidth();
+  unsigned CharWidth = E->getCharByteWidth();
 
   for (unsigned I = 0; I != N; ++I) {
     uint32_t CodeUnit = E->getCodeUnit(I);



More information about the cfe-commits mailing list