[PATCH] D23792: IR: Properly handle escape characters in Attribute::getAsString()

John McCall via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 04:15:17 PDT 2016


rjmccall added a comment.

In https://reviews.llvm.org/D23792#522872, @honggyu.kim wrote:

> In `Attribute::getAsString()`, it is expected to return `std::string` as the name describes. I think `getAsString()` function should not print the string directly with `PrintEscapedString()`. If I directly print attribute string here, we have to modify many functions in the execution paths above. The only problem here is printing `Val`.  That's why I added a new function `GetEscapedString()`.  Please correct me if there's a better approach.


PrintEscapedString prints to a raw_ostream that's passed in as a parameter, and there's a raw_string_ostream that will just append to a std::string.

John.


https://reviews.llvm.org/D23792





More information about the llvm-commits mailing list