[llvm] 86cbf3d - [JITLink] Add explicit conversion to silence warnings / errors on bots.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 11 13:13:06 PST 2023


Author: Lang Hames
Date: 2023-02-11T13:11:02-08:00
New Revision: 86cbf3d5f8a208e1129b4d75383ef792f1d8a4aa

URL: https://github.com/llvm/llvm-project/commit/86cbf3d5f8a208e1129b4d75383ef792f1d8a4aa
DIFF: https://github.com/llvm/llvm-project/commit/86cbf3d5f8a208e1129b4d75383ef792f1d8a4aa.diff

LOG: [JITLink] Add explicit conversion to silence warnings / errors on bots.

Commit 10b5fec2563 uses a char -1 value, which triggers narrowing conversion
warnings / errors on some platforms (see e.g.
https://lab.llvm.org/buildbot/#/builders/36/builds/30312). Adding an explicit
conversion should fix this.

Added: 
    

Modified: 
    llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp b/llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp
index dbcd285ef0cb..90353b542869 100644
--- a/llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp
+++ b/llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp
@@ -721,7 +721,7 @@ TEST(LinkGraphTest, GraphAllocationMethods) {
   EXPECT_EQ(Buf1.size(), 10U);
 
   // Test allocation of content-backed buffer.
-  ArrayRef<char> Buf2Src = {1, -1, 0, 42};
+  ArrayRef<char> Buf2Src = {1, static_cast<char>(-1), 0, 42};
   auto Buf2 = G.allocateContent(Buf2Src);
   EXPECT_EQ(Buf2, Buf2Src);
 


        


More information about the llvm-commits mailing list