[llvm] 5188b9a - [ORC] Make WrapperFunctionResult's ValuePtr member non-const.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 15 04:26:08 PDT 2021


Author: Lang Hames
Date: 2021-06-15T21:24:12+10:00
New Revision: 5188b9af84c487b0c5456ba7019a2bf029f6146a

URL: https://github.com/llvm/llvm-project/commit/5188b9af84c487b0c5456ba7019a2bf029f6146a
DIFF: https://github.com/llvm/llvm-project/commit/5188b9af84c487b0c5456ba7019a2bf029f6146a.diff

LOG: [ORC] Make WrapperFunctionResult's ValuePtr member non-const.

The const qualifier was a hangover from an earlier iteration that allowed
wrapper functions to return pointers to const memory. This feature has
been removed, so there's no reason for this to be const any more, and
removing it eliminates const-cast warnings.

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
index d975728b108d..f6d7c820720c 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
@@ -27,7 +27,7 @@ namespace detail {
 // DO NOT USE DIRECTLY.
 // Must be kept in-sync with compiler-rt/lib/orc/c-api.h.
 union CWrapperFunctionResultDataUnion {
-  const char *ValuePtr;
+  char *ValuePtr;
   char Value[sizeof(ValuePtr)];
 };
 
@@ -74,7 +74,7 @@ class WrapperFunctionResult {
   ~WrapperFunctionResult() {
     if ((R.Size > sizeof(R.Data.Value)) ||
         (R.Size == 0 && R.Data.ValuePtr != nullptr))
-      free((void *)R.Data.ValuePtr);
+      free(R.Data.ValuePtr);
   }
 
   /// Release ownership of the contained detail::CWrapperFunctionResult.


        


More information about the llvm-commits mailing list