From e18eb616a83a8b1813650035e2e6f5a648a2ad19 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Wed, 20 Aug 2014 17:38:12 +0000 Subject: [PATCH] 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 --- include/llvm/Analysis/CFGPrinter.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/llvm/Analysis/CFGPrinter.h b/include/llvm/Analysis/CFGPrinter.h index e6d2ed1a686..035764837e6 100644 --- a/include/llvm/Analysis/CFGPrinter.h +++ b/include/llvm/Analysis/CFGPrinter.h @@ -72,13 +72,13 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { OutStr.erase(OutStr.begin()+i, OutStr.begin()+Idx); --i; } else if (ColNum == MaxColumns) { // Wrap lines. - if (LastSpace) { - OutStr.insert(LastSpace, "\\l..."); - ColNum = i - LastSpace; - LastSpace = 0; - i += 3; // The loop will advance 'i' again. - } - // Else keep trying to find a space. + // Wrap very long names even though we can't find a space. + if (!LastSpace) + LastSpace = i; + OutStr.insert(LastSpace, "\\l..."); + ColNum = i - LastSpace; + LastSpace = 0; + i += 3; // The loop will advance 'i' again. } else ++ColNum; -- 2.34.1