[PATCH] D38425: [clangd] Document highlights for clangd
Marc-Andre Laperle via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 4 10:19:46 PST 2017
malaperle added a comment.
Can you also reformat the code too with clang-format? I think there's a few things in ClangdUnit.h/.cpp
================
Comment at: clangd/ClangdServer.cpp:521
+ std::shared_ptr<CppFile> Resources = Units.getFile(File);
+ assert(Resources && "Calling findDocumentHighlights on non-added file");
+
----------------
We should do like findDefinitions here:
```
if (!Resources)
return llvm::make_error<llvm::StringError>(
"findDocumentHighlights called on non-added file",
llvm::errc::invalid_argument);
```
================
Comment at: clangd/ClangdServer.cpp:528
+ if (!AST)
+ Err = llvm::make_error<llvm::StringError>("Invalid AST",
+ llvm::errc::invalid_argument);
----------------
Woops, I forgot the return here if it's an error, so it should be:
```
if (!AST) {
Err = llvm::make_error<llvm::StringError>("Invalid AST",
llvm::errc::invalid_argument);
return;
}
```
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D38425
More information about the cfe-commits
mailing list