If ‘I’ is of type llvm::Instruction, we can print out the human-readable form (textual representation) of it by by, errs() << I;
I want the assign the exact same representation to a std::string to C type string. How can I do that?
If ‘I’ is of type llvm::Instruction, we can print out the human-readable form (textual representation) of it by by, errs() << I;
I want the assign the exact same representation to a std::string to C type string. How can I do that?
There is raw_string_ostream which prints to a std::string.
-Krzysztof
Answering my own question, the solution will be:
std::string str;
llvm::raw_string_ostream rso(str);
I.print(rso);