[clang-tools-extra] [Clangd] Sanitize path before recording into IncludeStructure during buildPreamble (PR #70798)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 7 11:09:22 PST 2023
https://github.com/Maddobun updated https://github.com/llvm/llvm-project/pull/70798
>From 33e22f554355280e36a7da12484ce8220de77fb5 Mon Sep 17 00:00:00 2001
From: Leo Zhu <yifu.zhu at microchip.com>
Date: Tue, 7 Nov 2023 13:02:51 -0500
Subject: [PATCH 1/3] wip
---
clang-tools-extra/clangd/Protocol.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h
index e88c804692568f5..d788d884137c330 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -101,7 +101,7 @@ struct URIForFile {
llvm::StringRef HintPath);
/// Retrieves absolute path to the file.
- llvm::StringRef file() const { return File; }
+ llvm::StringRef file() const { File; }
explicit operator bool() const { return !File.empty(); }
std::string uri() const { return URI::createFile(File).toString(); }
@@ -119,7 +119,7 @@ struct URIForFile {
}
private:
- explicit URIForFile(std::string &&File) : File(std::move(File)) {}
+ explicit URIForFile(std::string &&File) : File(std::move(maybeCaseFoldPath(File))) {}
std::string File;
};
>From 15f3ddc8915dcb92d67c91b6a7bfb8f1c56353f8 Mon Sep 17 00:00:00 2001
From: Leo Zhu <yifu.zhu at microchip.com>
Date: Tue, 7 Nov 2023 13:23:14 -0500
Subject: [PATCH 2/3] fix
---
clang-tools-extra/clangd/Protocol.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h
index d788d884137c330..50c78aa44213f1a 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -101,7 +101,7 @@ struct URIForFile {
llvm::StringRef HintPath);
/// Retrieves absolute path to the file.
- llvm::StringRef file() const { File; }
+ llvm::StringRef file() const { return File; }
explicit operator bool() const { return !File.empty(); }
std::string uri() const { return URI::createFile(File).toString(); }
>From 9327e6191d05f0545ebb759f99129d78f5af2bd2 Mon Sep 17 00:00:00 2001
From: Leo Zhu <yifu.zhu at microchip.com>
Date: Tue, 7 Nov 2023 14:08:41 -0500
Subject: [PATCH 3/3] fix
---
clang-tools-extra/clangd/Protocol.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h
index 50c78aa44213f1a..dd67a043f212117 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -26,6 +26,7 @@
#include "URI.h"
#include "index/SymbolID.h"
#include "support/MemoryTree.h"
+#include "support/Path.h"
#include "clang/Index/IndexSymbol.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/JSON.h"
More information about the cfe-commits
mailing list