summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Fix a regression issue caused by r348365.Haojian Wu2019-01-071-1/+11
| | | | | | | | | | | | | | | | | | | | | Summary: With r348365, we now detect libc++ dir using the actual compiler path (from the compilation command), rather than the resource-dir. This new behavior will cause clangd couldn't find libc++ dir (even the libc++ is built from the source) when using a fallback compilation command (`clang xxx`) The fix is to use `<clangd_install_dir>/clang` as the actual compiler path. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D56380 llvm-svn: 350515
* [clangd] Fix detecting atomics in stand-alone buildsMichal Gorny2019-01-031-0/+5
| | | | | | | | | | | | | Include CheckAtomic CMake module from LLVM in order to detect support for atomics when building stand-alone. Otherwise, the HAVE_CXX_ATOMICS64_WITHOUT_LIB variable is undefined and clangd wrongly attempts to link -latomic on systems not using the library. Original bug report: https://bugs.gentoo.org/667016 Differential Revision: https://reviews.llvm.org/D56061 llvm-svn: 350329
* [clangd] Move helpers from global namespace into anonymous namespace, NFC.Haojian Wu2019-01-031-22/+22
| | | | llvm-svn: 350325
* [clangd] Bump vscode-clangd v0.0.9Haojian Wu2019-01-031-1/+1
| | | | llvm-svn: 350324
* [clangd] Always try to build absolute pathKadir Cetinkaya2019-01-031-8/+1
| | | | | | | | | | | | | | | | | | | | Summary: This only changes behavior in cases when the file itself is a symlink. When canonicalizing paths do not look at tryGetRealPathName, which contains the resolved path for files that are symlinks. Instead first build the absolute path even if it contains some symlinks on the path. Then resolve only the symlinks on the path and leave it as it is if the file itself is a symlink. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D56263 llvm-svn: 350306
* [clangd] Check preceding char when completion triggers on ':' or '>'Ilya Biryukov2019-01-034-3/+104
| | | | | | | | | | | | | | | | | | Summary: Only run completion when we were trigerred on '->' and '::', otherwise send an error code in return. To avoid automatically invoking completions in cases like 'a >^' or 'a ? b :^'. Reviewers: hokein Reviewed By: hokein Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55994 llvm-svn: 350304
* [clangd] clang-format everything. NFCIlya Biryukov2019-01-0316-109/+103
| | | | llvm-svn: 350303
* [clangd] Show FileStatus in vscode-clangd.Haojian Wu2019-01-021-0/+37
| | | | | | | | | | | | | | Summary: The file status will be shown in the status bar. Depends on D55363. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55374 llvm-svn: 350210
* [clangd] Delete stray semicolon. NFCFangrui Song2018-12-241-1/+0
| | | | llvm-svn: 350040
* [clangd] Delete trailing ; NFCFangrui Song2018-12-231-1/+1
| | | | llvm-svn: 350037
* [clangd] Expose FileStatus to LSP.Haojian Wu2018-12-206-3/+76
| | | | | | | | | | | | | Summary: Add an LSP extension "textDocument/clangd.fileStatus" to emit file-status information. Reviewers: ilya-biryukov Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55363 llvm-svn: 349768
* [clangd] Don't miss the expected type in merge.Haojian Wu2018-12-201-0/+2
| | | | | | | | | | Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55918 llvm-svn: 349750
* [clangd] Unify path canonicalizations in the codebaseKadir Cetinkaya2018-12-195-76/+64
| | | | | | | | | | | | | | Summary: There were a few different places where we canonicalized paths, each one had its own flavor. This patch tries to unify them all under one place. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55818 llvm-svn: 349618
* [clangd] BackgroundIndex rebuilds symbol index periodically.Eric Liu2018-12-185-8/+70
| | | | | | | | | | | | | | | | | | Summary: Currently, background index rebuilds symbol index on every indexed file, which can be inefficient. This patch makes it only rebuild symbol index periodically. As the rebuild no longer happens too often, we could also build more efficient dex index. Reviewers: ilya-biryukov, kadircet Reviewed By: kadircet Subscribers: dblaikie, MaskRay, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D55770 llvm-svn: 349496
* [clangd] Change diskbackedstorage to be atomicKadir Cetinkaya2018-12-171-8/+33
| | | | | | | | | | | | | | | | Summary: There was a chance that multiple clangd instances could try to write same shard, in which case we would get a malformed file most likely. This patch changes the writing mechanism to first write to a temporary file and then rename it to fit real destination. Which is guaranteed to be atomic by POSIX. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D55417 llvm-svn: 349348
* [clangd] Only reduce priority of a thread for indexing.Kadir Cetinkaya2018-12-174-39/+58
| | | | | | | | | | | | | | | | | | Summary: We'll soon have tasks pending for reading shards from disk, we want them to have normal priority. Because: - They are not CPU intensive, mostly IO bound. - Give a good coverage for the project at startup, therefore it is worth spending some cycles. - We have only one task per whole CDB rather than one task per file. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D55315 llvm-svn: 349345
* [dexp] Change FuzzyFind to also print scope of symbolsKadir Cetinkaya2018-12-141-1/+2
| | | | | | | | | | | | | | | | Summary: When there are multiple symbols in the result of a fuzzy find with the same name, one has to perform an additional query to figure out which of those symbols are coming from the "interesting" scope. This patch prints the scope in fuzzy find results to get rid of the second symbol. Reviewers: hokein Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55705 llvm-svn: 349152
* [clangd] Fix an assertion failure in background index.Haojian Wu2018-12-141-0/+8
| | | | | | | | | | | | | | | Summary: When indexing a file which contains an uncompilable error, we will trigger an assertion failure -- the IndexFileIn data is not set, but we access them in the backgound index. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55650 llvm-svn: 349144
* [clangd] Enable cross-namespace completions by default in clangdEric Liu2018-12-131-1/+1
| | | | | | | | | | | | | | | | | | | Summary: Code completion will suggest symbols from any scope (incl. inaccessible scopes) when there's no qualifier explicitly specified. E.g. {F7689815} As we are assigning relatively low scores for cross-namespace completion items, the overall code completion quality doesn't regress. The feature has been tried out by a few folks, and the feedback is generally positive, so I think it should be ready to be enabled by default. Reviewers: hokein, ilya-biryukov, kadircet Reviewed By: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55649 llvm-svn: 349049
* [clangd] Refine the way of checking a declaration is referenced by the ↵Haojian Wu2018-12-131-12/+10
| | | | | | | | | | | | | | | | | written code. Summary: The previous solution (checking the AST) is not a reliable way to determine whether a declaration is explicitly referenced by the source code, we are still missing a few cases. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55191 llvm-svn: 349033
* [clangd] Avoid emitting Queued status when we are able to acquire the Barrier.Haojian Wu2018-12-133-3/+15
| | | | | | | | | | Reviewers: ilya-biryukov Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55359 llvm-svn: 349032
* [clangd] Move the utility function to anonymous namespace, NFC.Haojian Wu2018-12-131-32/+33
| | | | llvm-svn: 349031
* [clangd] C++ API for emitting file status.Haojian Wu2018-12-064-8/+98
| | | | | | Introduce clangd C++ API to emit the current status of file. llvm-svn: 348475
* [clangd] Dont provide locations for non-existent files.Kadir Cetinkaya2018-12-051-4/+7
| | | | | | | | | | | | | | Summary: We were getting assertion errors when we had bad file names, instead we should skip those. Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55275 llvm-svn: 348359
* Fix "array must be initialized with a brace-enclosed initializer" build error.Simon Pilgrim2018-12-041-1/+1
| | | | | | Try to fix clang-bpf-build buildbot. llvm-svn: 348262
* [clangd] Partition include graph on auto-index.Kadir Cetinkaya2018-12-042-47/+70
| | | | | | | | | | | | | | Summary: Partitions include graphs in auto-index so that each shards contains only part of the include graph related to itself. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55062 llvm-svn: 348252
* Fix compilation failure on Windows.Zachary Turner2018-12-031-1/+1
| | | | | | | This was introduced earlier but apparently used an incorrect class name so it doesn't compile on Windows. llvm-svn: 348176
* [clangd] Avoid memory-mapping files on WindowsIlya Biryukov2018-12-033-3/+87
| | | | | | | | | | | | | | | | | | Summary: Memory-mapping files on Windows leads to them being locked and prevents editors from saving changes to those files on disk. This is fine for the compiler, but not acceptable for an interactive tool like clangd. Therefore, we choose to avoid using memory-mapped files on Windows. Reviewers: hokein, kadircet Reviewed By: kadircet Subscribers: yvvan, zturner, nik, malaperle, mgorny, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55139 llvm-svn: 348147
* [clangd] Fix a stale comment, NFC.Haojian Wu2018-12-032-3/+2
| | | | llvm-svn: 348133
* [clangd] Get rid of AST matchers in CodeComplete, NFCHaojian Wu2018-12-031-9/+18
| | | | | | | | | | | | | | Summary: The isIndexedForCodeCompletion is called in the code patch of SymbolCollector. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55206 llvm-svn: 348130
* [clangd] Populate include graph during static indexing action.Kadir Cetinkaya2018-11-305-14/+128
| | | | | | | | | | | | | | | Summary: This is the second part for introducing include hierarchy into index files produced by clangd. You can see the base patch that introduces structures and discusses the future of the patches in D54817 Reviewers: ilya-biryukov Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54999 llvm-svn: 348005
* [clangd] Penalize destructor and overloaded operators in code completion.Eric Liu2018-11-302-2/+12
| | | | | | | | | | Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55061 llvm-svn: 347983
* [clangd] Drop injected class name when class scope is not explicitly specified.Eric Liu2018-11-301-3/+14
| | | | | | | | | | | | Summary: E.g. allow injected "A::A" in `using A::A^` but not in "A^". Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55065 llvm-svn: 347982
* [clangd] Bump vscode-clangd v0.0.8Haojian Wu2018-11-301-1/+1
| | | | llvm-svn: 347969
* [clangd] Fix junk output in clangd vscode pluginHaojian Wu2018-11-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When using the vscode clangd plugin, lots and lots of junk output is printed to the output window, which constantly reopens itself. Example output: I[11:13:17.733] <-- textDocument/codeAction(4) I[11:13:17.733] --> reply:textDocument/codeAction(4) 0 ms I[11:13:17.937] <-- textDocument/codeAction(5) I[11:13:17.937] --> reply:textDocument/codeAction(5) 0 ms I[11:13:18.557] <-- textDocument/hover(6) I[11:13:18.606] --> reply:textDocument/hover(6) 48 ms This should prevent that from happening. Patch by James Findley! Reviewers: ioeric, ilya-biryukov, hokein Reviewed By: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55052 llvm-svn: 347968
* [clangd] Fix test broken in r347754.Eric Liu2018-11-281-1/+1
| | | | llvm-svn: 347755
* [clangd] Less penalty for cross-namespace completions.Eric Liu2018-11-281-2/+2
| | | | llvm-svn: 347754
* [clangd] Canonicalize file path in URIForFile.Eric Liu2018-11-287-49/+112
| | | | | | | | | | | | | | | | | | | Summary: File paths in URIForFile can come from index or local AST. Path from index goes through URI transformation and the final path is resolved by URI scheme and could be potentially different from the original path. Hence, we should do the same transformation for all paths. We do this in URIForFile, which now converts a path to URI and back to a canonicalized path. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54845 llvm-svn: 347739
* [clangd] Fix backward-compatibility - follow-up to textDocument/SymbolInfoJan Korous2018-11-281-1/+2
| | | | | | Apparently clang 3.6 couldn't build the preceding patch. llvm-svn: 347738
* [clangd] Bump vscode-clangd v0.0.7Haojian Wu2018-11-281-1/+1
| | | | llvm-svn: 347737
* [clangd] textDocument/SymbolInfo extensionJan Korous2018-11-278-0/+132
| | | | | | | | | | New method returning symbol info for given source position. Differential Revision: https://reviews.llvm.org/D54799 rdar://problem/46050281 llvm-svn: 347675
* [clangd][NFC] Move SymbolID to a separate fileJan Korous2018-11-276-77/+126
| | | | | | | | Prerequisity for textDocument/SymbolInfo Differential Revision: https://reviews.llvm.org/D54799 llvm-svn: 347674
* [clangd] Put direct headers into srcs section.Kadir Cetinkaya2018-11-277-42/+118
| | | | | | | | | | | | | | | | | | | Summary: Currently, there's no way of knowing about header files using compilation database, since it doesn't contain header files as entries. Using this information, restoring from cache using compile commands becomes possible instead of doing directory traversal. Also, we can issue indexing actions for out-of-date headers even if source files depending on them haven't changed. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54817 llvm-svn: 347669
* [clangd] Prevent thread starvation in tests on loaded systems.Sam McCall2018-11-273-1/+13
| | | | | | | | | | | | | | Summary: Background index deliberately runs low-priority, but for tests this may stop them making progress. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D54938 llvm-svn: 347655
* [clangd] NFC: Prefer `isa<>` to `dyn_cast<>` to do the checking.Henry Wong2018-11-271-2/+2
| | | | | | | | | | | | | | Summary: Prefer `isa<>` to `dyn_cast<>` when there only need a checking. Reviewers: ilya-biryukov, MaskRay Reviewed By: ilya-biryukov, MaskRay Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits, MTC Differential Revision: https://reviews.llvm.org/D54878 llvm-svn: 347635
* [clangd] Do not drop diagnostics from macrosIlya Biryukov2018-11-261-1/+1
| | | | | | if they still end up being in the main file. llvm-svn: 347574
* [clangd] Enable auto-index behind a flag.Sam McCall2018-11-269-19/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Ownership and configuration: The auto-index (background index) is maintained by ClangdServer, like Dynamic. (This means ClangdServer will be able to enqueue preamble indexing in future). For now it's enabled by a simple boolean flag in ClangdServer::Options, but we probably want to eventually allow injecting the storage strategy. New 'sync' command: In order to meaningfully test the integration (not just unit-test components) we need a way for tests to ensure the asynchronous index reads/writes occur before a certain point. Because these tests and assertions are few, I think exposing an explicit "sync" command for use in tests is simpler than allowing threading to be completely disabled in the background index (as we do for TUScheduler). Bugs: I fixed a couple of trivial bugs I found while testing, but there's one I can't. JSONCompilationDatabase::getAllFiles() may return relative paths, and currently we trigger an assertion that assumes they are absolute. There's no efficient way to resolve them (you have to retrieve the corresponding command and then resolve against its directory property). In general I think this behavior is broken and we should fix it in JSONCompilationDatabase and require CompilationDatabase::getAllFiles() to be absolute. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54894 llvm-svn: 347567
* [clangd] Fix compilation of IndexBenchmarkIlya Biryukov2018-11-261-2/+2
| | | | llvm-svn: 347566
* [clangd] Fix use-after-free with expected types in indexingIlya Biryukov2018-11-261-2/+4
| | | | llvm-svn: 347563
* [clangd] Add type boosting in code completionIlya Biryukov2018-11-264-2/+43
| | | | | | | | | | | | Reviewers: sammccall, ioeric Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52276 llvm-svn: 347562
OpenPOWER on IntegriCloud