[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

Simon Marchi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 10 08:28:57 PDT 2018


simark marked 8 inline comments as done.
simark added inline comments.


================
Comment at: clangd/SourceCode.h:69
 
+llvm::Optional<std::string> getRealPath(const FileEntry *F,
+                                        const SourceManager &SourceMgr);
----------------
ilya-biryukov wrote:
> This function looks like a good default choice for normalizing paths before putting them into LSP structs, ClangdServer responses, etc.
> I suggest we add a small comment here with a guideline for everyone to attempt using it whenever possible. WDYT?
What about this:

```
/// Get the real/canonical path of \p F.  This means:
///
///   - Absolute path
///   - Symlinks resolved
///   - No "." or ".." component
///   - No duplicate or trailing directory separator
///
/// This function should be used when sending paths to clients, so that paths
/// are normalized as much as possible.
```


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D48687





More information about the cfe-commits mailing list