[llvm] [C API] Add function to create constantRange attributes to C API (PR #90505)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 23:24:03 PDT 2024


================
@@ -308,4 +310,36 @@ TEST(Attributes, RemoveParamAttributes) {
   EXPECT_EQ(AL.getNumAttrSets(), 0U);
 }
 
+TEST(Attributes, ConstantRangeAttributeCAPI) {
+  LLVMContext C;
+  {
+    const unsigned NumBits = 8;
+    const uint64_t LowerWords[] = {0};
+    const uint64_t UpperWords[] = {42};
+
+    auto Range =
+        ConstantRange(APInt(NumBits, ArrayRef<uint64_t>(LowerWords, 1)),
+                      APInt(NumBits, ArrayRef<uint64_t>(UpperWords, 1)));
----------------
andjo403 wrote:

nice much cleaner

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


More information about the llvm-commits mailing list