LLVM String Value objects: How can I retrieve the String from a Value?

后端 未结 2 789
野趣味
野趣味 2021-02-20 16:30

When building the IR from an existing AST, my AST has some string values (at compile-time they are built from std::string) and I want to set them safely as ll

2条回答
  •  Happy的楠姐
    2021-02-20 16:35

    Yes, ConstantArray is what you should use here. In order to retrieve the value later just use ConstantArray::getAsCString(). If you have assertions turned on, it will assert if something will went wrong (e.g. you will try to grab string from the array w/o zero terminator).

提交回复
热议问题