[PATCH] [Graph Writer] Limit the length of the graph name because Windows can't handle it.

Michael Spencer bigcheesegs at gmail.com
Thu May 22 16:39:54 PDT 2014


Closed by commit rL209483 (authored by mspencer).

http://reviews.llvm.org/D3883

Files:
  llvm/trunk/include/llvm/Support/GraphWriter.h

Index: llvm/trunk/include/llvm/Support/GraphWriter.h
===================================================================
--- llvm/trunk/include/llvm/Support/GraphWriter.h
+++ llvm/trunk/include/llvm/Support/GraphWriter.h
@@ -325,7 +325,10 @@
 std::string WriteGraph(const GraphType &G, const Twine &Name,
                        bool ShortNames = false, const Twine &Title = "") {
   int FD;
-  std::string Filename = createGraphFilename(Name, FD);
+  // Windows can't always handle long paths, so limit the length of the name.
+  std::string N = Name.str();
+  N = N.substr(0, std::min<std::size_t>(N.size(), 140));
+  std::string Filename = createGraphFilename(N, FD);
   raw_fd_ostream O(FD, /*shouldClose=*/ true);
 
   if (FD == -1) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3883.9723.patch
Type: text/x-patch
Size: 740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140522/43eaa52e/attachment.bin>


More information about the llvm-commits mailing list