diff options
author | Eric Liu <ioeric@google.com> | 2018-11-28 10:30:42 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2018-11-28 10:30:42 +0000 |
commit | 4d814a93e5b9d130097413bc027efca9524b36ce (patch) | |
tree | fca975e18d42da20bf4d863182031186674084d0 /clang-tools-extra/unittests/clangd/ClangdUnitTests.cpp | |
parent | 613c80d22f2428fb7e70754340c6a515e8e8d9c9 (diff) | |
download | bcm5719-llvm-4d814a93e5b9d130097413bc027efca9524b36ce.tar.gz bcm5719-llvm-4d814a93e5b9d130097413bc027efca9524b36ce.zip |
[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
Diffstat (limited to 'clang-tools-extra/unittests/clangd/ClangdUnitTests.cpp')
-rw-r--r-- | clang-tools-extra/unittests/clangd/ClangdUnitTests.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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<clangd::Fix> Fixes) { |