[PATCH] D18727: Add support for attribute in the C API

Jakob Bornecrantz via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 3 16:31:37 PDT 2016


Wallbraker added inline comments.

================
Comment at: tools/llvm-c-test/echo.cpp:771-777
@@ -761,1 +770,9 @@
+
+    // Copy attributes
+    for (unsigned k = 0, e = LLVMGetEndAttrKind(); k < e; ++k) {
+      if (LLVMHasFunctionAttr(Cur, k))
+        LLVMAddFunctionAttr(F, k);
+      if (LLVMHasReturnAttr(Cur, k))
+        LLVMAddReturnAttr(F, k);
+    }
 
----------------
deadalnix wrote:
> I went for the alternative first, namely mapping the attribute set. It was much bigger/more complex, and did not provide any significant advantage in real world use case.
> 
> When interacting with attribute, I usually want to check if X has attribute Y, or set attribute Y on X. Rarely do I want to iterate over all attributes (in fact, this test is the only time I ended up doing this).
> 
> This test does a lot of wasteful things on purpose in order to grill the C API. I think we are fine here.
Ah that makes sense and also we discussed this on privately and came to the same conclusion. No need for the extra API.


http://reviews.llvm.org/D18727





More information about the llvm-commits mailing list