[clang] [clang][test] Use sizeof(wchar_t) instead of __WCHAR_WIDTH__ (PR #218707)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 25 08:16:01 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
`__WCHAR_WIDTH__` does not exist everywhere and this broke a builder: https://lab.llvm.org/buildbot/#/builders/2/builds/60118
---
Full diff: https://github.com/llvm/llvm-project/pull/218707.diff
1 Files Affected:
- (modified) clang/unittests/AST/ByteCode/Pointer.cpp (+3-3)
``````````diff
diff --git a/clang/unittests/AST/ByteCode/Pointer.cpp b/clang/unittests/AST/ByteCode/Pointer.cpp
index a42388d434c0c..bc45da69a0410 100644
--- a/clang/unittests/AST/ByteCode/Pointer.cpp
+++ b/clang/unittests/AST/ByteCode/Pointer.cpp
@@ -315,7 +315,7 @@ TEST(Pointer, Strings) {
Pointee = GlobalPtr.load<Pointer>();
ASSERT_TRUE(Pointee.isStringPointer());
ASSERT_EQ(Pointee.getNumElems(), 7u);
- ASSERT_EQ(Pointee.elemSize(), __WCHAR_WIDTH__ / 8u);
+ ASSERT_EQ(Pointee.elemSize(), sizeof(wchar_t));
D = match(varDecl(hasGlobalStorage(), hasName("c")).bind("c"), ASTCtx)[0]
.getNodeAs<VarDecl>("c");
@@ -327,12 +327,12 @@ TEST(Pointer, Strings) {
Pointee = GlobalPtr.load<Pointer>();
ASSERT_TRUE(Pointee.isStringPointer());
ASSERT_EQ(Pointee.getNumElems(), 7u);
- ASSERT_EQ(Pointee.elemSize(), __WCHAR_WIDTH__ / 8u);
+ ASSERT_EQ(Pointee.elemSize(), sizeof(wchar_t));
ASSERT_EQ(Pointee.getIndex(), 5u);
APValue APV = Pointee.toAPValue(ASTCtx);
ASSERT_TRUE(APV.isLValue());
ASSERT_FALSE(APV.isLValueOnePastTheEnd());
- ASSERT_EQ(APV.getLValueOffset().getQuantity(), 5u * (__WCHAR_WIDTH__ / 8u));
+ ASSERT_EQ(APV.getLValueOffset().getQuantity(), 5u * sizeof(wchar_t));
ASSERT_TRUE(APV.hasLValuePath());
const auto &Path = APV.getLValuePath();
ASSERT_EQ(Path.size(), 1u);
``````````
</details>
https://github.com/llvm/llvm-project/pull/218707
More information about the cfe-commits
mailing list