From 4d814a93e5b9d130097413bc027efca9524b36ce Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 28 Nov 2018 10:30:42 +0000 Subject: [clangd] Canonicalize file path in URIForFile. Summary: File paths in URIForFile can come from index or local AST. Path from index goes through URI transformation and the final path is resolved by URI scheme and could be potentially different from the original path. Hence, we should do the same transformation for all paths. We do this in URIForFile, which now converts a path to URI and back to a canonicalized path. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54845 llvm-svn: 347739 --- clang-tools-extra/unittests/clangd/ClangdUnitTests.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clang-tools-extra/unittests/clangd/ClangdUnitTests.cpp') diff --git a/clang-tools-extra/unittests/clangd/ClangdUnitTests.cpp b/clang-tools-extra/unittests/clangd/ClangdUnitTests.cpp index 39c8f0c2488..4b31677ae18 100644 --- a/clang-tools-extra/unittests/clangd/ClangdUnitTests.cpp +++ b/clang-tools-extra/unittests/clangd/ClangdUnitTests.cpp @@ -258,9 +258,10 @@ main.cpp:2:3: error: something terrible happened)"); toLSPDiags( D, #ifdef _WIN32 - URIForFile("c:\\path\\to\\foo\\bar\\main.cpp"), + URIForFile::canonicalize("c:\\path\\to\\foo\\bar\\main.cpp", + /*TUPath=*/""), #else - URIForFile("/path/to/foo/bar/main.cpp"), + URIForFile::canonicalize("/path/to/foo/bar/main.cpp", /*TUPath=*/""), #endif ClangdDiagnosticOptions(), [&](clangd::Diagnostic LSPDiag, ArrayRef Fixes) { -- cgit v1.2.3