Simple question: "I have a ConstantDataArray of type [7 x i8]
, how can I cast it to have the i8*
type?"
EDIT More Context:
The ConstantDataArray is created as follows:
ConstantDataArray::getString(Fn->getContext(), "Hello", true);
And I have created a LLVM:Function that has an argument with the type coming from Type::getInt8PtrTy(getGlobalContext())
and I want to cast the array to this type, so I can pass it as an argument.
I'm developing a pass
您可以使用IRBuilder
的CreateGlobalStringPtr
,它是用于创建全局字符串常量并返回指向其第一个字符的i8*
的便捷包装器。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.