[clang-tools-extra] r294314 - [clangd] Strip file:// from the URI when calling formatting.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 7 08:10:17 PST 2017


Author: d0k
Date: Tue Feb  7 10:10:17 2017
New Revision: 294314

URL: http://llvm.org/viewvc/llvm-project?rev=294314&view=rev
Log:
[clangd] Strip file:// from the URI when calling formatting.

It confuses FileManager on windows.

Modified:
    clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp

Modified: clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp?rev=294314&r1=294313&r2=294314&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp (original)
+++ clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp Tue Feb  7 10:10:17 2017
@@ -63,6 +63,9 @@ static std::string formatCode(StringRef
   // Call clang-format.
   // FIXME: Don't ignore style.
   format::FormatStyle Style = format::getLLVMStyle();
+  // On windows FileManager doesn't like file://. Just strip it, clang-format
+  // doesn't need it.
+  Filename.consume_front("file://");
   tooling::Replacements Replacements =
       format::reformat(Style, Code, Ranges, Filename);
 




More information about the cfe-commits mailing list