[PATCH] D34107: [clangd] Allow to override contents of the file during completion.

2017-06-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. https://reviews.llvm.org/D34107 Files: clangd/ClangdServer.cpp clangd/ClangdServer.h unittests/clangd/ClangdTests.cpp Index: unittests/clangd/ClangdTests.cpp === --- unittests/clangd/Clangd

[PATCH] D34107: [clangd] Allow to override contents of the file during completion.

2017-06-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 102300. ilya-biryukov marked 2 inline comments as done. ilya-biryukov added a comment. Fixed formatting, added a space (see krasimir's comment) https://reviews.llvm.org/D34107 Files: clangd/ClangdServer.cpp clangd/ClangdServer.h unittests/clangd

[PATCH] D34107: [clangd] Allow to override contents of the file during completion.

2017-06-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: unittests/clangd/ClangdTests.cpp:452 + StringRef(OverridenSourceContents)) +.Value; +EXPECT_TRUE(ContainsItem(CodeCompletionResultsOverriden, "cbc")); krasimir wrote: > Is t

[PATCH] D34146: [clangd] Allow to override contents of the file during completion.

2017-06-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. This is a reapplied r305280 with a fix to the crash found by build bots (StringRef to an out-of-scope local std::string). https://reviews.llvm.org/D34146 Files: clangd/ClangdServer.cpp clangd/ClangdServer.h unittests/clangd/ClangdTests.cpp Index: unit

[PATCH] D34146: [clangd] Allow to override contents of the file during completion.

2017-06-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdServer.cpp:190 + llvm::Optional OverridenContents) { + std::string DraftStorage; + if (!OverridenContents) { This is the relevant line that changed from the previous review.

[PATCH] D34148: [clangd] Store references instead of unique_ptrs in ClangdServer.

2017-06-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. ClangdServer was owning objects passed to it in constructor for no good reason. Lots of stuff was moved from the heap to the stack thanks to this change. https://reviews.llvm.org/D34148 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/

[PATCH] D34151: [clangd] Add a filename parameter to FileSystemProvider.

2017-06-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. https://reviews.llvm.org/D34151 Files: clangd/ClangdServer.cpp clangd/ClangdServer.h unittests/clangd/ClangdTests.cpp Index: unittests/clangd/ClangdTests.cpp === --- unittests/clangd/Clangd

[PATCH] D34137: [clangd] Add priority to completion item sort text

2017-06-14 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdUnit.cpp:156 assert(CCS->getTypedText()); +CCS->getPriority(); Item.kind = getKind(Result.CursorKind); This is a no-op, commited incidentally? Comment at: c

[PATCH] D34201: [clangd] Move dependencies of ClangdLSPServer out of its implementation

2017-06-14 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdLSPServer.h:26 /// dispatch and ClangdServer together. -class ClangdLSPServer { +class ClangdLSPServer : public DiagnosticsConsumer { public: I would not expect ClangdLSPServer to be passed as a Diag

[PATCH] D34269: [clangd] Add "Go to Declaration" functionality

2017-06-16 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Hi @malaperle-ericsson. Thanks for the patch. IndexingAction has a very simple interface, exactly what clangd needs and nothing more. BTW, we had a bug open for that: https://bugs.llvm.org/show_bug.cgi?id=33261, feel free to reassign to yourself. =

[PATCH] D34287: Moved code hanlding precompiled preamble out of the ASTUnit.

2017-06-16 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. Herald added a subscriber: mgorny. https://reviews.llvm.org/D34287 Files: include/clang/Frontend/ASTUnit.h include/clang/Frontend/PrecompiledPreamble.h lib/Frontend/ASTUnit.cpp lib/Frontend/CMakeLists.txt lib/Frontend/PrecompiledPreamble.cpp Index:

[PATCH] D34287: Moved code hanlding precompiled preamble out of the ASTUnit.

2017-06-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 102993. ilya-biryukov added a comment. Removed a stray comment (of a previously removed declaration). https://reviews.llvm.org/D34287 Files: include/clang/Frontend/ASTUnit.h include/clang/Frontend/PrecompiledPreamble.h lib/Frontend/ASTUnit.cpp

[PATCH] D34287: Moved code hanlding precompiled preamble out of the ASTUnit.

2017-06-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: include/clang/Frontend/PrecompiledPreamble.h:248 +/// doesn't restore the state \p CI had before calling AddImplicitPreamble, only +/// clears relevant settings, so that preamble is disabled in \p CI. +} // namespace clang ---

[PATCH] D34287: Moved code hanlding precompiled preamble out of the ASTUnit.

2017-06-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 103053. ilya-biryukov marked 2 inline comments as done. ilya-biryukov added a comment. - Added default initializers to PreambleFileHash. - Update file comments to address klimek's questions. https://reviews.llvm.org/D34287 Files: include/clang/Front

[PATCH] D34287: Moved code hanlding precompiled preamble out of the ASTUnit.

2017-06-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: include/clang/Frontend/PrecompiledPreamble.h:42-43 +/// destructors. +/// An assertion will fire if two PCHTempFiles are created with the same name, +/// so it's not intended to be used outside preamble-handling. +class TempPCHFile

[PATCH] D34287: Moved code hanlding precompiled preamble out of the ASTUnit.

2017-06-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 103203. ilya-biryukov added a comment. Removed PossiblyOwnedBuffer, added an extra copy instead. This makes the code much simpler. https://reviews.llvm.org/D34287 Files: include/clang/Frontend/ASTUnit.h include/clang/Frontend/PrecompiledPreamble.h

[PATCH] D34287: Moved code hanlding precompiled preamble out of the ASTUnit.

2017-06-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 103216. ilya-biryukov added a comment. - Made TempPCHFile an inner class of PrecompiledPreamble. - Made PreambleFileHash an inner class of PrecompiledPreamble. - Changed stanalone functions to members. - Removed some member accessors that were no longer

[PATCH] D34287: Moved code hanlding precompiled preamble out of the ASTUnit.

2017-06-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: include/clang/Frontend/PrecompiledPreamble.h:124 +/// CanReusePreamble + AddImplicitPreamble to make use of it. +class PrecompiledPreamble { +public: klimek wrote: > ilya-biryukov wrote: > > klimek wrote: > > > If

[PATCH] D34469: Use vfs::FileSystem in ASTUnit when creating CompilerInvocation.

2017-06-21 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. It used to always call into the RealFileSystem before. https://reviews.llvm.org/D34469 Files: include/clang/Frontend/Utils.h lib/Frontend/ASTUnit.cpp lib/Frontend/CreateInvocationFromCommandLine.cpp Index: lib/Frontend/CreateInvocationFromCommandLine

[PATCH] D34470: [clangd] Allow to override resource dir in ClangdServer.

2017-06-21 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. https://reviews.llvm.org/D34470 Files: clangd/ClangdServer.cpp clangd/ClangdServer.h clangd/ClangdUnit.cpp clangd/ClangdUnit.h clangd/ClangdUnitStore.h Index: clangd/ClangdUnitStore.h =

[PATCH] D34269: [clangd] Add "Go to Declaration" functionality

2017-06-21 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Looks good now, but I think we definitely need to change `unique_ptr>` to `vector` before submitting it. I won't be available until next Wednesday, so feel free to submit without my final approval. Comment at: clangd/ClangdUnit.cpp:276 +class D

[PATCH] D41237: [Frontend] Handle skipped bodies in template instantiations

2017-12-14 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. ilya-biryukov added reviewers: sepavloff, bkramer. - Fixed an assert in Sema::InstantiateFunctionDefinition and added support for instantiating a function template with skipped body. - Properly call setHasSkippedBody for FunctionTemplateDecl passed to Sema::A

[PATCH] D40489: [clangd] Changed tracing interfaces

2017-12-14 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/Trace.cpp:134 + Callback = T->beginSpan(Ctx, Name); + if (!Callback) +return; sammccall wrote: > I'm not sure this is useful. Tracers that aren't interested in args can't opt > out by providing a null

[PATCH] D40488: [clangd] Implemented tracing using Context

2017-12-14 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 126951. ilya-biryukov added a comment. - Renamed TracingSession to Session (it is always used qualified via trace::Session anyway) Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D40488 Files: clangd/ClangdUnit.cpp clangd/JSONRPCDi

[PATCH] D40489: [clangd] Changed tracing interfaces

2017-12-14 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 126957. ilya-biryukov added a comment. Merged with head Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D40489 Files: clangd/Trace.cpp clangd/Trace.h Index: clangd/Trace.h ===

[PATCH] D39375: [clang] Add PPCallbacks list to preprocessor when building a preacompiled preamble.

2017-12-15 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. LGTM modulo a few comments. AFAIK, @Nebiroth does not have a commit access, so I'll land this with minor tweaks to unblock the other patch. Comment at: include

[PATCH] D41280: [clangd] Don't use the optional "severity" when comparing Diagnostic.

2017-12-15 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Maybe we could use a struct containing only `range` and `message` (e.g. `pair`) as a key to search for fixits instead of `Diagnostic`? Having an `operator <` that does not take all fields into account seems shaky. Repository: rCTE Clang Tools Extra https://rev

[PATCH] D38639: [clangd] #include statements support for Open definition

2017-12-18 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov requested changes to this revision. ilya-biryukov added inline comments. This revision now requires changes to proceed. Comment at: clangd/ClangdServer.cpp:446 std::vector Result; - Resources->getAST().get()->runUnderLock([Pos, &Result, this](ParsedAST *AST) {

[PATCH] D41281: [clangd] Index-based code completion.

2017-12-18 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Here are a few more comments. Comment at: clangd/CodeComplete.cpp:847 + if (Opts.Index && SCInfo.SSInfo) { +// FIXME: log warning with logger if sema code completion have collected +// results. NIT: FIXME(ioeric)? Also,

[PATCH] D35894: [clangd] Code hover for Clangd

2017-12-18 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdLSPServer.cpp:284 +void ClangdLSPServer::onCodeHover(Ctx C, TextDocumentPositionParams &Params) { + + auto H = Server.findHover(C, NIT: remove empty line Comment at: clangd/ClangdSe

[PATCH] D38639: [clangd] #include statements support for Open definition

2017-12-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov requested changes to this revision. ilya-biryukov added a comment. This revision now requires changes to proceed. Thanks for addressing the comments quickly. I took another look and added a few more comments. This moves in the right direction, though, this is really close to landing.

[PATCH] D41237: [Frontend] Handle skipped bodies in template instantiations

2017-12-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: lib/Sema/SemaDecl.cpp:12184 Decl *Sema::ActOnSkippedFunctionBody(Decl *Decl) { - if (FunctionDecl *FD = dyn_cast_or_null(Decl)) + if (FunctionDecl *FD = Decl->getAsFunction()) FD->setHasSkippedBody(); sepav

[PATCH] D41237: [Frontend] Handle skipped bodies in template instantiations

2017-12-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: lib/Sema/SemaDecl.cpp:12184 Decl *Sema::ActOnSkippedFunctionBody(Decl *Decl) { - if (FunctionDecl *FD = dyn_cast_or_null(Decl)) + if (FunctionDecl *FD = Decl->getAsFunction()) FD->setHasSkippedBody(); ilya-

[PATCH] D41237: [Frontend] Handle skipped bodies in template instantiations

2017-12-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 127473. ilya-biryukov marked an inline comment as done. ilya-biryukov added a comment. - Added a check for null in ActOnSkippedBody Repository: rC Clang https://reviews.llvm.org/D41237 Files: lib/Sema/SemaDecl.cpp lib/Sema/SemaTemplateInstantia

[PATCH] D41365: [clang] Add BeforeExecute method to PrecompiledPreamble

2017-12-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov requested changes to this revision. ilya-biryukov added inline comments. This revision now requires changes to proceed. Comment at: include/clang/Frontend/PrecompiledPreamble.h:249 + /// from a CompilerInstance. + virtual void BeforeExecute(CompilerInstance &CI);

[PATCH] D41281: [clangd] Index-based code completion.

2017-12-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/CodeComplete.cpp:334 + Item.insertTextFormat = InsertTextFormat::PlainText; + // FIXME: sort symbols appropriately. + Item.sortText = ""; ioeric wrote: > ilya-biryukov wrote: > > NIT: FIXME(ioeric)? > > A

[PATCH] D41281: [clangd] Index-based code completion.

2017-12-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. LGTM. I still think that we should move the `SymbolIndex` out of the struct, but don't want to block this patch. Comment at: clangd/CodeComplete.h:64 + + // Populated internally by clangd, do not set. + ///

[PATCH] D41365: [clang] Add BeforeExecute method to PrecompiledPreamble

2017-12-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov requested changes to this revision. ilya-biryukov added a comment. This revision now requires changes to proceed. LGTM modulo the comment. Should I land this for you? Comment at: include/clang/Frontend/PrecompiledPreamble.h:247 + /// Can be used to store refere

[PATCH] D41365: [clang] Add BeforeExecute method to PrecompiledPreamble

2017-12-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. LG Repository: rC Clang https://reviews.llvm.org/D41365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llv

[PATCH] D38639: [clangd] #include statements support for Open definition

2017-12-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov requested changes to this revision. ilya-biryukov added a comment. This revision now requires changes to proceed. Another round of review Comment at: clangd/ClangdUnit.cpp:113 + CppFilePreambleCallbacks(IncludeReferenceMap &IRM) + : IRM(IRM) {} ---

[PATCH] D41483: [clangd] Index symbols share storage within a slab.

2017-12-21 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/index/Index.h:136 + // Intern table for strings. Not StringPool as we don't refcount, just insert. + llvm::StringSet Strings; llvm::DenseMap Symbols; A comment on why we use `BumpPtrAllocator` here mig

[PATCH] D41492: [Frontend] Correctly handle instantiating ctors with skipped bodies

2017-12-21 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. ilya-biryukov added reviewers: sepavloff, klimek. Previsouly clang tried instantiating member initializers even if ctor body was skipped, this caused spurious errors (see the test). Repository: rC Clang https://reviews.llvm.org/D41492 Files: lib/Sema/Se

[PATCH] D38639: [clangd] #include statements support for Open definition

2017-12-21 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/XRefs.cpp:183 + unsigned CharNumber = SourceMgr.getSpellingColumnNumber( + DeclMacrosFinder->getSearchedLocation()); + ilya-biryukov wrote: > Replace with `DeclMacrosFinder->getSearchedLocation

[PATCH] D41495: [clangd] Skip function bodies when building the preamble

2017-12-21 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. ilya-biryukov added a reviewer: sammccall. Herald added a subscriber: klimek. To make building preambles faster and keep them smaller. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D41495 Files: clangd/ClangdUnit.cpp Index: clangd/Clangd

[PATCH] D41495: [clangd] Skip function bodies when building the preamble

2017-12-21 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. I haven't done proper benchmarks, but here are some numbers from running this on my machine: Sizes of preamble with (before the change) and without (after the change) functon bodies: | File | Before | After | | ClangdUnit.cpp | 49.58M

[PATCH] D41495: [clangd] Skip function bodies when building the preamble

2017-12-22 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdUnit.cpp:536 + // so we set SkipFunctionBodies back to false after preamble is built. + assert(!CI->getFrontendOpts().SkipFunctionBodies); + CI->getFrontendOpts().SkipFunctionBodies = true; -

[PATCH] D41495: [clangd] Skip function bodies when building the preamble

2017-12-22 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 127995. ilya-biryukov marked an inline comment as done. ilya-biryukov added a comment. - Updated a comment Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D41495 Files: clangd/ClangdUnit.cpp Index: clangd/ClangdUnit.cpp

[PATCH] D41506: [clangd] Use Builder for symbol slabs, and use sorted-vector for storage

2017-12-22 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/index/Index.cpp:39 + [](const Symbol &S, const SymbolID &I) { + return S.ID == I; + }); Should this be `S.ID < I`?

[PATCH] D41535: Add -vfsoverlay option for Clang-Tidy

2017-12-22 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. IIUC, you want to pass an overlay so that clang-tidy will read the file opened in the IDE from a different directory? Could you provide add `-ivfsoverlay` option to your compile command instead? $ clang --help | grep vfs -ivfsoverlay Overlay the virtual fi

[PATCH] D41594: Support `ivfsoverlay` option in Tooling

2017-12-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. I'm not sure if it's ok to ignore the shared `FileManager` here. @klimek, @bkramer, @alexfh, does tooling library rely on having the same `FileManager` for all invocations? Is it just a performance optimization or there's more to it? Comment at:

[PATCH] D41535: Add -vfsoverlay option for Clang-Tidy

2017-12-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. In https://reviews.llvm.org/D41535#963859, @vladimir.plyashkun wrote: > Unfortunately, `-ivfsoverlay` in the compile commands works for the compiler > invocation, but it doesn't work for tooling. This looks like a bug in tooling, but let's wait for responses on t

[PATCH] D41594: Support `ivfsoverlay` option in Tooling

2017-12-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: lib/Tooling/Tooling.cpp:287 + if (Files->getVirtualFileSystem() != VirtualFileSystem) { +Files = new FileManager(Invocation->getFileSystemOpts(), VirtualFileSystem); + } vladimir.plyashkun wrote: > ilya-biry

[PATCH] D41495: [clangd] Skip function bodies when building the preamble

2018-01-02 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. In https://reviews.llvm.org/D41495#965627, @nik wrote: > Hmm, could libclang profit from something like this, too? (or does it > already?) It could. The problem with ASTUnit is that it returns all diagnostics from `store_diag_begin`/`end`, not just the ones from

[PATCH] D41005: Reuse preamble even if an unsaved file does not exist

2018-01-03 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: include/clang/Frontend/ASTUnit.h:193 /// some number of calls. - unsigned PreambleRebuildCounter; + unsigned PreambleRebuildCountdownCounter; + NIT: Maybe shorten to `PreambleRebuildCountdown`? It's not a grea

[PATCH] D41661: [clangd] Don't navigate to forward class declaration when go to definition.

2018-01-03 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/XRefs.cpp:68 + // declaration, and it could be a forward declaration. + auto Def = std::find_if(D->redecls_begin(), D->redecls_end(), + [](const Decl *D) { return IsDefinition(D); }); -

[PATCH] D41668: [clangd] Add static index for the global code completion.

2018-01-03 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/tool/ClangdMain.cpp:122 +llvm::cl::desc( +"YAML-format global symbol file to build the static index. It is only " +"available when 'enable-index-based-completion' is enabled."), Let's als

[PATCH] D41759: [clangd] Catch more symbols in SymbolCollector.

2018-01-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/index/SymbolCollector.cpp:89 +// violations. +if (ND->isInAnonymousNamespace()) return true; Why don't we include symbols from anonymous namespaces too? They are very similar to static symbols

[PATCH] D41759: [clangd] Catch more symbols in SymbolCollector.

2018-01-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. LGTM (see the review comment about adding a comment in the code too) Comment at: clangd/index/SymbolCollector.cpp:89 +// violations. +if (ND->isInAnonym

[PATCH] D41823: [clangd] Add more filters for collected symbols.

2018-01-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. In https://reviews.llvm.org/D41823#970725, @hokein wrote: > With this patch, the index-based code completion will not provide any > candidates for `ns1::MyClass::^` (as the index-based completion drops all > results from clang's completion engine), we need a way

[PATCH] D38639: [clangd] #include statements support for Open definition

2018-01-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. @malaperle, hi! Both new diff and updating this works, so feel free the one that suits you best. I tend to look over the whole change on each new round of reviews anyway. Comment at: clangd/ClangdUnit.cpp:113 + CppFilePreambleCallbacks(Includ

[PATCH] D41668: [clangd] Add static index for the global code completion.

2018-01-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdLSPServer.h:40 + bool BuildDynamicSymbolIndex, + std::unique_ptr StaticIdx); sammccall wrote: > is there a reason ClangdServer should own this? I can imagine this >

[PATCH] D41901: [clangd] Remove duplicates from code completion

2018-01-10 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. ilya-biryukov added a reviewer: sammccall. Herald added a subscriber: klimek. This patch removes hidden items from code completion. Hidden items are the ones that are hidden by other items (e.g., by other items in the child scopes). This patch addresses a parti

[PATCH] D41823: [clangd] Add more filters for collected symbols.

2018-01-10 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. LGTM. I'd add a comment pointing to code in include-fixer we're borrowing, though. (See the relevant comment) Comment at: clangd/index/SymbolCollector.cpp:80 +: decl(unless

[PATCH] D41823: [clangd] Add more filters for collected symbols.

2018-01-10 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/index/SymbolCollector.cpp:80 +: decl(unless(isExpansionInMainFile())), +hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl(), +*D, *ASTCtx)

[PATCH] D41907: [clangd] Pass Context to onDiagnosticsReady callback

2018-01-10 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. ilya-biryukov added a reviewer: sammccall. Herald added a subscriber: klimek. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D41907 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/ClangdServer.cpp clangd/ClangdServer.h

[PATCH] D38639: [clangd] #include statements support for Open definition

2018-01-11 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdUnit.h:51 +using IncludeReferenceMap = std::unordered_map; + We use `unordered_map` as a `vector>` here. (i.e. we never look up values by key, because we don't only the range, merely a point in the

[PATCH] D43648: [clangd] Debounce streams of updates.

2018-02-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. LGTM Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D43648 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D44000: [clang] Fix use-after-free on code completion

2018-03-02 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. ilya-biryukov added a reviewer: sammccall. Herald added subscribers: ioeric, jkorous-apple, klimek. Found by asan. Fiddling with code completion AST after FrontendAction::Exceute can lead to errors. Calling the callback in ProcessCodeCompleteResults to make sur

[PATCH] D44000: [clang] Fix use-after-free on code completion

2018-03-02 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 136707. ilya-biryukov added a comment. Remove code refactoring from the patch. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44000 Files: clangd/CodeComplete.cpp Index: clangd/CodeComplete.cpp =

[PATCH] D44000: [clang] Fix use-after-free on code completion

2018-03-02 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 136710. ilya-biryukov added a comment. Remove a trace for "sema cleanup", it is not very informative now that we run the callback under the "sema completion" trace Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44000 Files: clangd/

[PATCH] D44000: [clang] Fix use-after-free on code completion

2018-03-02 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 136714. ilya-biryukov marked 7 inline comments as done. ilya-biryukov added a comment. Addressed review comments Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44000 Files: clangd/CodeComplete.cpp Index: clangd/CodeComplete.cpp ===

[PATCH] D44003: [clangd] Fix unintentionally loose fuzzy matching, and the tests masking it.

2018-03-05 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. LGTM, but note the unreachable code comment Comment at: unittests/clangd/FuzzyMatchTests.cpp:35 + + friend raw_ostream &operator<<(raw_ostream &OS, const Expec

[PATCH] D44088: [clangd] Extract ClangdServer::Options struct.

2018-03-05 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdServer.h:94 + /// Returns a statically allocated instance. (Stateless, safe to share). + static RealFileSystemProvider *get(); + Maybe return a reference instead of a pointer? Comm

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-06 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. ilya-biryukov added reviewers: hokein, ioeric, sammccall. Herald added subscribers: jkorous-apple, mgorny, klimek. The new implementation attaches notes to diagnostic message and shows the original diagnostics in the message of the note. Repository: rCTE Cl

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-06 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. This revision is still missing tests, but I wanted to get feedback for the overall design and the new diagnostic messages. So sending out for review now. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44142 _

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-06 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/Diagnostics.h:28 +/// DiagList. +struct PersistentDiag { + llvm::StringRef Message; This could probably use a better name Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44142 _

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-07 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. I would vouch for adding a log level instead. It's a very well understood concept that certainly covers this use-case and can be useful in other places. WDYT? Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44226

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. In https://reviews.llvm.org/D44226#1030639, @simark wrote: > In https://reviews.llvm.org/D44226#1030625, @ilya-biryukov wrote: > > > I would vouch for adding a log level instead. It's a very well understood > > concept that certainly covers this use-case and can be

[PATCH] D44217: [clang-tidy] Enable Python 3 support for add_new_check.py

2018-03-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clang-tools-extra/clang-tidy/add_new_check.py:24 with open(filename, 'r') as f: -lines = f.readlines() +lines = [x for x in f.readlines()] `readlines()` returns a list in Python3 too. Maybe remove list

[PATCH] D44251: [clangd] Early return for #include goto definition.

2018-03-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. LGTM. I think this was part of initial changed and I asked to make it this way, but I don't remember why. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44251

[PATCH] D44251: [clangd] Early return for #include goto definition.

2018-03-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Sorry, being pedantic here... We're not saving time on parsing, but on walking over the AST :-) Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44251 ___ cfe-commits mailing list cfe-commits@lists.llvm

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/Logger.cpp:19 Logger *L = nullptr; +bool Verbose_ = false; } // namespace Could we move the flag to implementation of `Logger`? I.e.: ``` class Logger { virtual log(const llvm::Twine &Message, bool Verbo

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/Logger.cpp:19 Logger *L = nullptr; +bool Verbose_ = false; } // namespace simark wrote: > ilya-biryukov wrote: > > Could we move the flag to implementation of `Logger`? > > I.e.: > > ``` > > class Logger {

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdLSPServer.cpp:329 + {"title", + llvm::formatv("Apply FixIt {0}", GetFixitMessage(D.message))}, {"command", ExecuteCommandParams::CLANGD_APPLY_FIX_COMMAND}, sammccall wrote

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 137589. ilya-biryukov marked 9 inline comments as done. ilya-biryukov added a comment. This is not final, there are still unadressed comments. - Significantly simplified the implementation by removing the DiagList, etc. - Addressed some of the rest of t

[PATCH] D44272: [clangd] Support incremental document syncing

2018-03-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov requested changes to this revision. ilya-biryukov added inline comments. This revision now requires changes to proceed. Comment at: clangd/ClangdLSPServer.cpp:101 json::obj{ -{"textDocumentSync", 1}, +{"textDocumentSync", 2},

[PATCH] D44217: [clang-tidy] Enable Python 3 support for add_new_check.py

2018-03-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. LGTM. Thanks for the fix! https://reviews.llvm.org/D44217 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm

[PATCH] D44272: [clangd] Support incremental document syncing

2018-03-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdServer.cpp:557 // 64-bit unsigned integer. if (Version < LastReportedDiagsVersion) return; When you'll try remove the `DraftMgr`, this piece of code will be hard to refactor because i

[PATCH] D44294: [clangd] Fix diagnostic errors in the test code, NFC.

2018-03-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: unittests/clangd/XRefsTests.cpp:587 - const char *HeaderContents = R"cpp([[]]int a;)cpp"; + const char *HeaderContents = R"cpp([[]]#ifndef TEST_H_ + #define TEST_H_ I would g

[PATCH] D44300: [SemaOverload] Fixed crash on code completion

2018-03-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision. ilya-biryukov added reviewers: bkramer, sammccall, ioeric, hokein. The relevant failing assertion message is: ../tools/clang/lib/Sema/SemaInit.cpp:8411: PerformCopyInitialization(): Assertion `InitE && "No initialization expression?"' failed. See the added te

[PATCH] D44300: [SemaOverload] Fixed crash on code completion

2018-03-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 137743. ilya-biryukov added a comment. - Added a comment Repository: rC Clang https://reviews.llvm.org/D44300 Files: lib/Sema/SemaOverload.cpp test/CodeCompletion/enable-if-attr-crash.cpp Index: test/CodeCompletion/enable-if-attr-crash.cpp ==

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 137977. ilya-biryukov marked 8 inline comments as done. ilya-biryukov added a comment. Addressed review comments. The only thing that's left on my todo-list is a test for toLSPDiags(). Everything else should be ready. Repository: rCTE Clang Tools Ex

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 137985. ilya-biryukov added a comment. - Added unit test for toLSPDiags Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44142 Files: clangd/CMakeLists.txt clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/ClangdServer.

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 137987. ilya-biryukov marked 14 inline comments as done. ilya-biryukov added a comment. - Addressed review comments Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44142 Files: clangd/CMakeLists.txt clangd/ClangdLSPServer.cpp cla

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/Diagnostics.h:35 + DiagnosticsEngine::Level Severity; + llvm::SmallVector FixIts; + // Since File is only descriptive, we store a separate flag to distinguish sammccall wrote: > sammccall wrote: > > As di

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov marked 2 inline comments as done. ilya-biryukov added inline comments. Comment at: clangd/ClangdLSPServer.cpp:329 + {"title", + llvm::formatv("Apply FixIt {0}", GetFixitMessage(D.message))}, {"command", ExecuteCommandParams::CLANGD_APPL

[PATCH] D44293: [clangd] Fix irrelevant declaratations in goto definition (on macros).

2018-03-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/XRefs.cpp:201 std::vector MacroInfos = DeclMacrosFinder->takeMacroInfos(); + if (!MacroInfos.empty()) { +for (auto Item : MacroInfos) { I wonder whether we should fix the `DeclrationAndMacrosFinder`

[PATCH] D44142: [clangd] Revamp handling of diagnostics.

2018-03-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 138004. ilya-biryukov added a comment. - Replace equality comparison ops with matchers, they were only used in tests. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44142 Files: clangd/CMakeLists.txt clangd/ClangdLSPServer.cpp c

[PATCH] D44294: [clangd] Fix diagnostic errors in the test code, NFC.

2018-03-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added inline comments. This revision is now accepted and ready to land. Comment at: unittests/clangd/XRefsTests.cpp:587 - const char *HeaderContents = R"cpp([[]]int a;)cpp"; + const char *HeaderContents = R"cpp([[]]#ifndef T

[PATCH] D44293: [clangd] Fix irrelevant declaratations in goto definition (on macros).

2018-03-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/XRefs.cpp:201 std::vector MacroInfos = DeclMacrosFinder->takeMacroInfos(); + if (!MacroInfos.empty()) { +for (auto Item : MacroInfos) { hokein wrote: > ilya-biryukov wrote: > > I wonder whether we sh

<    2   3   4   5   6   7   8   9   10   11   >