Tweak CFGPrinter to wrap very long names.

I added wrapping to the CFGPrinter a while back so the -view-cfg
output is actually viewable. I've since enountered very long mangled
names with the same problem, so I'm slightly tweaking this code to
work in that case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216087 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick 2014-08-20 17:38:12 +00:00
parent 1506856c3b
commit e18eb616a8

View File

@ -72,13 +72,13 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
OutStr.erase(OutStr.begin()+i, OutStr.begin()+Idx); OutStr.erase(OutStr.begin()+i, OutStr.begin()+Idx);
--i; --i;
} else if (ColNum == MaxColumns) { // Wrap lines. } else if (ColNum == MaxColumns) { // Wrap lines.
if (LastSpace) { // Wrap very long names even though we can't find a space.
OutStr.insert(LastSpace, "\\l..."); if (!LastSpace)
ColNum = i - LastSpace; LastSpace = i;
LastSpace = 0; OutStr.insert(LastSpace, "\\l...");
i += 3; // The loop will advance 'i' again. ColNum = i - LastSpace;
} LastSpace = 0;
// Else keep trying to find a space. i += 3; // The loop will advance 'i' again.
} }
else else
++ColNum; ++ColNum;