[llvm] 9d5e647 - [JITLink] Fix think-o in handwritten CWrapperFunctionResult -> Error converter.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 12 10:36:36 PST 2021
Author: Lang Hames
Date: 2021-11-12T10:36:17-08:00
New Revision: 9d5e6474281cd4d774ede800eb339e1dc610e471
URL: https://github.com/llvm/llvm-project/commit/9d5e6474281cd4d774ede800eb339e1dc610e471
DIFF: https://github.com/llvm/llvm-project/commit/9d5e6474281cd4d774ede800eb339e1dc610e471.diff
LOG: [JITLink] Fix think-o in handwritten CWrapperFunctionResult -> Error converter.
We need to skip the length field when generating error strings.
No test case: This hand-hacked deserializer should be removed in the near future
once JITLink can use generic ORC APIs (including SPS and WrapperFunction).
Added:
Modified:
llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
index 0e5ed8e3d1ce3..4fb349255f75c 100644
--- a/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
@@ -40,8 +40,9 @@ Error toError(CWrapperFunctionResult R) {
char *Content = Large ? R.Data.ValuePtr : R.Data.Value;
if (Content[0]) {
HasError = true;
- ErrMsg.resize(R.Size - 1);
- memcpy(&ErrMsg[0], Content + 1, R.Size - 1);
+ constexpr unsigned StrStart = 1 + sizeof(uint64_t);
+ ErrMsg.resize(R.Size - StrStart);
+ memcpy(&ErrMsg[0], Content + StrStart, R.Size - StrStart);
}
if (Large)
free(R.Data.ValuePtr);
More information about the llvm-commits
mailing list