[llvm] r216087 - Tweak CFGPrinter to wrap very long names.

Andrew Trick atrick at apple.com
Wed Aug 20 10:38:12 PDT 2014


Author: atrick
Date: Wed Aug 20 12:38:12 2014
New Revision: 216087

URL: http://llvm.org/viewvc/llvm-project?rev=216087&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/Analysis/CFGPrinter.h

Modified: llvm/trunk/include/llvm/Analysis/CFGPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CFGPrinter.h?rev=216087&r1=216086&r2=216087&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CFGPrinter.h (original)
+++ llvm/trunk/include/llvm/Analysis/CFGPrinter.h Wed Aug 20 12:38:12 2014
@@ -72,13 +72,13 @@ struct DOTGraphTraits<const Function*> :
         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;





More information about the llvm-commits mailing list