[clang] [libclang][test] Fix narrowing when initializing CXUnsavedFile::Length (PR #228405)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 16 06:59:58 PDT 2026
================
@@ -82,9 +82,11 @@ class LibclangParseTest : public ::testing::Test {
fixed_addr_string(new std::string(Filename)),
fixed_addr_string(new std::string(Contents))));
UnsavedFiles.push_back({
- it.first->first->c_str(), // filename
- it.first->second->c_str(), // contents
- it.first->second->size() // length
+ it.first->first->c_str(), // filename
+ it.first->second->c_str(), // contents
+ // CXUnsavedFile::Length is `unsigned long`, which is 32 bits on
+ // 64-bit Windows, so converting from size_t here narrows.
+ static_cast<unsigned long>(it.first->second->size()) // length
----------------
UebelAndre wrote:
Updated!
https://github.com/llvm/llvm-project/pull/228405
More information about the cfe-commits
mailing list