[PATCH] D10725: Improve testing for the C API

Amaury SECHET via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 17:05:49 PST 2016


deadalnix added inline comments.

================
Comment at: tools/llvm-c-test/echo.cpp:25
@@ +24,3 @@
+// Provide DenseMapInfo for C API opaque types.
+template<typename T>
+struct CAPIDenseMap {};
----------------
echristo wrote:
> You changed it to use a DenseMap, but I'm curious why?
The default implementation require knowledge of pointer alignement. The C API pointer are opaques, so it doesn't work. The solution was suggested by @chandlerc on IRC.

================
Comment at: tools/llvm-c-test/echo.cpp:76-80
@@ +75,7 @@
+      if (ParamCount > 0) {
+        Params = (LLVMTypeRef*) malloc(ParamCount * sizeof(LLVMTypeRef));
+        LLVMGetParamTypes(Src, Params);
+        for (unsigned i = 0; i < ParamCount; i++) {
+          Params[i] = clone_type(Params[i], Ctx);
+        }
+      }
----------------
echristo wrote:
> This is C++ now yes?
Yes, but still very much C style. Do you want me to use a Vector or something alike ?


http://reviews.llvm.org/D10725





More information about the llvm-commits mailing list