mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[IR] Simplify code to print string attributes a bit. NFC.
This commit is contained in:
parent
e2b0533d74
commit
8d0e7ecb99
@ -504,19 +504,19 @@ std::string Attribute::getAsString(bool InAttrGrp) const {
|
||||
//
|
||||
if (isStringAttribute()) {
|
||||
std::string Result;
|
||||
Result += (Twine('"') + getKindAsString() + Twine('"')).str();
|
||||
|
||||
std::string AttrVal = std::string(pImpl->getValueAsString());
|
||||
if (AttrVal.empty()) return Result;
|
||||
|
||||
// Since some attribute strings contain special characters that cannot be
|
||||
// printable, those have to be escaped to make the attribute value printable
|
||||
// as is. e.g. "\01__gnu_mcount_nc"
|
||||
{
|
||||
raw_string_ostream OS(Result);
|
||||
OS << "=\"";
|
||||
printEscapedString(AttrVal, OS);
|
||||
OS << "\"";
|
||||
OS << '"' << getKindAsString() << '"';
|
||||
|
||||
// Since some attribute strings contain special characters that cannot be
|
||||
// printable, those have to be escaped to make the attribute value
|
||||
// printable as is. e.g. "\01__gnu_mcount_nc"
|
||||
const auto &AttrVal = pImpl->getValueAsString();
|
||||
if (!AttrVal.empty()) {
|
||||
OS << "=\"";
|
||||
printEscapedString(AttrVal, OS);
|
||||
OS << "\"";
|
||||
}
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user