[PATCH] D46497: [clangd] Populate #include insertions as additional edits in completion items.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 15 04:52:04 PDT 2018
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.
Nice, ship it!
================
Comment at: clangd/CodeComplete.cpp:317
+ if (Includes && !D->IncludeHeader.empty()) {
+ // Fallback to canonical header if declaration location is invalid.
+ auto Edit = [&]() -> Expected<Optional<TextEdit>> {
----------------
is this comment still relevant here?
================
Comment at: clangd/CodeComplete.cpp:792
+ if (!Style) {
+ log("Failed to get FormaStyle for file" + Input.FileName +
+ ". Fall back to use LLVM style. Error: " +
----------------
nit: FormatStyle
================
Comment at: clangd/CodeComplete.cpp:803
+ Clang->getPreprocessor().addPPCallbacks(collectInclusionsInMainFileCallback(
+ Clang->getSourceManager(), [&Includes](Inclusion Inc) {
+ Includes->get()->addExisting(std::move(Inc));
----------------
nit: includes is a pointer, capture by value?
================
Comment at: clangd/CodeComplete.cpp:962
Output = runWithSema();
+ Includes.release(); // Make sure this doesn't out-live Clang.
SPAN_ATTACH(Tracer, "sema_completion_kind",
----------------
This leaks. reset (or = nullptr)
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D46497
More information about the cfe-commits
mailing list