summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/GlobalCompilationDatabase.h
Commit message (Collapse)AuthorAgeFilesLines
* [clangd] (take 2) Try harder to find a plausible `clang` as argv0, ↵Sam McCall2019-12-061-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | particularly on Mac. Summary: This was originally committed in 88bccded8fa169481fa367debf5ec615640635a1, and reverted in 93f77617abba512d2861e2fc50ce385883f587b6. This version is now much more testable: the "detect toolchain properties" part is still not tested but also not active in tests. All the command manipulation based on the detected properties is directly tested, and also not active in other tests. Fixes https://github.com/clangd/clangd/issues/211 Fixes https://github.com/clangd/clangd/issues/178 Reviewers: kbobyrev, ilya-biryukov Subscribers: mgorny, ormris, cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay Tags: #clang Differential Revision: https://reviews.llvm.org/D71029
* [clangd] Fix background index not triggering on windows due to case mismatch.Sam McCall2019-07-261-8/+8
| | | | | | | | | | | | | | Summary: This isn't a general fix to all paths where we assume case-sensitivity, it's a minimally-invasive fix targeting the llvm 9 branch. Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65320 llvm-svn: 367112
* [clangd] Reland rL365634Kadir Cetinkaya2019-07-111-9/+34
| | | | | | | | | This was reverted in rL365678, the failure was due to YAML parsing of compile_commands.json. Converting backslashes to forward slashes to fix the issue in unittest. llvm-svn: 365748
* rL365634 adds a unique_ptr<CompilationDatabase> in ↵Sterling Augustine2019-07-101-5/+1
| | | | | | | | | | | | GobalCompilationDatabase.h:108 but CompilationDatabase is only forward declared. This makes the header not compile standalone, because unique_ptrs expect to have the full-definition of the... Summary: ...template argument. Remove the forward declaration and include the appropriate header instead. Remove CompileCommand too, which is also in the header. llvm-svn: 365713
* Revert "[clangd] Filter out non-governed files from broadcast"Matthew Voss2019-07-101-34/+9
| | | | | | | | | | This reverts commit d5214dfa7b5650745eaeb102857c9e90adb16137. It's causing failures, both in our local CI and the PS4 Windows bot. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26872/steps/test/logs/stdio llvm-svn: 365678
* [clangd] Filter out non-governed files from broadcastKadir Cetinkaya2019-07-101-9/+34
| | | | | | | | | | | | | | | | Summary: This also turns off implicit discovery of additional compilation databases. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64247 llvm-svn: 365634
* [clangd] Enable extraction of system includes from custom toolchainsKadir Cetinkaya2019-06-261-0/+7
| | | | | | | | | | | | | | | | | | Summary: Some custom toolchains come with their own header files and compiler drivers. Those compiler drivers implicitly know about include search path for those headers. This patch aims to extract that information from drivers and add it to the command line when invoking clang frontend. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62804 llvm-svn: 364389
* [clangd] Filter out plugin related flags and move all commandline ↵Kadir Cetinkaya2019-01-221-1/+4
| | | | | | | | | | | | | | | | | | | | manipulations into OverlayCDB. Summary: Some projects make use of clang plugins when building, but clangd is not aware of those plugins therefore can't work with the same compile command arguments. There were multiple places clangd performed commandline manipulations, this one also moves them all into OverlayCDB. Reviewers: ilya-biryukov Subscribers: klimek, sammccall, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D56841 llvm-svn: 351788
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [clangd] Auto-index watches global CDB for changes.Sam McCall2018-11-261-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of receiving compilation commands, auto-index is triggered by just filenames to reindex, and gets commands from the global comp DB internally. This has advantages: - more of the work can be done asynchronously (fetching compilation commands upfront can be slow for large CDBs) - we get access to the CDB which can be used to retrieve interpolated commands for headers (useful in some cases where the original TU goes away) - fits nicely with the filename-only change observation from r347297 The interface to GlobalCompilationDatabase gets extended: when retrieving a compile command, the GCDB can optionally report the project the file belongs to. This naturally fits together with getCompileCommand: it's hard to implement one without the other. But because most callers don't care, I've ended up with an awkward optional-out-param-in-virtual method pattern - maybe there's a better one. This is the main missing integration point between ClangdServer and BackgroundIndex, after this we should be able to add an auto-index flag. Reviewers: ioeric, kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits, ilya-biryukov Differential Revision: https://reviews.llvm.org/D54865 llvm-svn: 347538
* [clangd] Allow observation of changes to global CDBs.Sam McCall2018-11-201-5/+14
| | | | | | | | | | | | | | | | | | Summary: Currently, changes *within* CDBs are not tracked (CDB has no facility to do so). However, discovery of new CDBs are tracked (all files are marked as modified). Also, files whose compilation commands are explicitly set are marked modified. The intent is to use this for auto-index. Newly discovered files will be indexed with low priority. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54475 llvm-svn: 347297
* [clangd] Make in-memory CDB always available as an overlay, refactor.Sam McCall2018-11-021-9/+16
| | | | | | | | | | | | | | | | | | | | | | | Summary: The new implementation is a GlobalCompilationDatabase that overlays a base. Normally this is the directory-based CDB. To preserve the behavior of compile_args_from=LSP, the base may be null. The OverlayCDB is always present, and so the extensions to populate it are always supported. It also allows overriding the flags of the fallback command. This is just unit-tested for now, but the plan is to expose this as an extension on the initialize message. This addresses use cases like https://github.com/thomasjo/atom-ide-cpp/issues/16 Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53687 llvm-svn: 345970
* [clangd] Remove didOpen extraFlags extension.Sam McCall2018-11-021-9/+0
| | | | | | | | | | | | | | | | | | | | Summary: This was added in D34947 to support YCM, but YCM actually provides *all* args, and this was never actually used. Meanwhile, we grew another extension that allows specifying all args. I did find one user of this extension: https://github.com/thomasjo/atom-ide-cpp. I'll reach out, there are multiple good alternatives: - compile_commands.txt can serve the same purpose as .clang_complete there - we can add an extension to support setting the fallback command Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53641 llvm-svn: 345969
* [clangd] Remove unused CDB function. NFCSam McCall2018-10-251-3/+0
| | | | llvm-svn: 345233
* [clangd] Don't invalidate LSP-set compile commands when closing a file.Sam McCall2018-10-251-4/+0
| | | | | | | | | | | | | | | | Summary: It doesn't make much sense: setting them is not coupled to opening the file, it's an asynchronous notification. I don't think this is a breaking change - this behavior is hard to observe! Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53642 llvm-svn: 345231
* [clangd] Remove caching of compilation database commands.Sam McCall2018-10-231-27/+0
| | | | | | | | | | | | | | | | | Summary: The CDB implementations used in open-source code are fast, and our private slow CDB will soon do the relevant caching itself. Simplifying the GlobalCDB layer in clangd is important to get auto-index implemented at the right layer. Reviewers: ioeric, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53439 llvm-svn: 345024
* NFC: Enforce good formatting across multiple clang-tools-extra filesKirill Bobyrev2018-08-141-3/+3
| | | | | | | | | | | This patch improves readability of multiple files in clang-tools-extra and enforces LLVM Coding Guidelines. Reviewed by: ioeric Differential Revision: https://reviews.llvm.org/D50707 llvm-svn: 339687
* [clangd] allow clients to control the compilation database by passing inAlex Lorenz2018-08-011-0/+23
| | | | | | | | | | | | | compilationDatabaseChanges in the 'workspace/didChangeConfiguration' request This commit allows clangd to use an in-memory compilation database that's controlled from the LSP client (-compile_args_from=lsp). It extends the 'workspace/didChangeConfiguration' request to allow the client to pass in a compilation database subset that needs to be updated in the workspace. Differential Revision: https://reviews.llvm.org/D49758 llvm-svn: 338597
* [clangd] Move caching of compile args out of ClangdServer.Ilya Biryukov2018-06-131-0/+28
| | | | | | | | | | | | | | | | | | | | | Summary: Caching is now handled by ClangdLSPServer and hidden behind the GlobalCompilationDatabase interface. This simplifies ClangdServer. This change also removes the SkipCache flag from addDocument, which is now obsolete. No behavioral changes are intended, the clangd binary still caches the compile commands on the first read. Reviewers: sammccall Reviewed By: sammccall Subscribers: mgorny, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48068 llvm-svn: 334585
* Parse .h files as objective-c++ if we don't have a compile command.Sam McCall2018-04-201-0/+1
| | | | | | | | | | | | Summary: This makes C++/objC not totally broken, without hurting C files too much. Reviewers: ilya-biryukov Subscribers: klimek, jkorous-apple, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D45442 llvm-svn: 330418
* [clangd] DidChangeConfiguration NotificationSimon Marchi2018-02-221-0/+3
| | | | | | | | | | | | | | | | | | | | Summary: Implementation of DidChangeConfiguration notification handling in clangd. This currently only supports changing one setting: the path of the compilation database to be used for the current project. In other words, it is no longer necessary to restart clangd with a different command line argument in order to change the compilation database. Reviewers: malaperle, krasimir, bkramer, ilya-biryukov Subscribers: jkorous-apple, ioeric, simark, klimek, ilya-biryukov, arphaman, rwols, cfe-commits Differential Revision: https://reviews.llvm.org/D39571 Signed-off-by: Simon Marchi <simon.marchi@ericsson.com> Signed-off-by: William Enright <william.enright@polymtl.ca> llvm-svn: 325784
* [clangd] Simplify GlobalCompilationDatabase, cache missing GCDsSam McCall2017-12-221-2/+2
| | | | llvm-svn: 321350
* [clangd] Implemented logging using ContextIlya Biryukov2017-12-131-3/+1
| | | | | | | | | | | | Reviewers: sammccall, ioeric, hokein Reviewed By: sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D40486 llvm-svn: 320576
* [clangd] GlobalCompilationDatabase interface changesSam McCall2017-12-041-11/+21
| | | | | | | | | | | | | | | | | | Summary: - GlobalCompilationDatabase now returns a single command (that's all we use) - fallback flags are now part of the GlobalCompilationDatabase. There's a default implementation that they can optionally customize. - this allows us to avoid invoking the fallback logic on two separate codepaths - race on extra flags fixed by locking the mutex - made GCD const-correct (DBGCD does have mutating methods) Reviewers: hokein Subscribers: klimek, cfe-commits, ilya-biryukov Differential Revision: https://reviews.llvm.org/D40733 llvm-svn: 319647
* [clangd] Command line arg to specify compile_commands.json pathIlya Biryukov2017-10-021-1/+6
| | | | | | | | | | Summary: Adds compileCommands command line argument to specify an absolute path directly to the requested compile_commands.json for flags. Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D37150 llvm-svn: 314678
* [clangd] Introduced Logger interface.Ilya Biryukov2017-09-201-0/+6
| | | | | | | | | | | | | | Summary: This fixes a bunch of logging-related FIXMEs. Reviewers: bkramer, krasimir, malaperle Reviewed By: malaperle Subscribers: malaperle, klimek, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D37972 llvm-svn: 313730
* [clangd] Rewrote AST and Preamble management.Ilya Biryukov2017-08-011-1/+1
| | | | | | | | | | | | | | Summary: The new implementation allows code completion that never waits for AST. Reviewers: bkramer, krasimir, klimek Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36133 llvm-svn: 309696
* [clangd] Add support for per-file extra flagsKrasimir Georgiev2017-07-061-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds the ability to specify user-defined extra flags per opened file through the LSP layer. This is a non-standard extension to the protocol. I've already created a feature request about it for upstream lsp: https://github.com/Microsoft/language-server-protocol/issues/255 The particular use-case is ycmd, which has a python script for figuring out extra flags per file: https://github.com/Valloric/ycmd#flagsforfile-filename-kwargs- Reviewers: ilya-biryukov, klimek, bkramer Reviewed By: ilya-biryukov Subscribers: cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34947 llvm-svn: 307241
* Fixing compilation failures on buildbots.Ilya Biryukov2017-05-161-0/+1
| | | | llvm-svn: 303154
* Restored r303067 and fixed failing test.Ilya Biryukov2017-05-161-0/+59
| | | | | | | | | | | | | | | | | | | | | Summary: This commit restores r303067(reverted by r303094) and fixes the 'formatting.test' failure. The failure is due to destructors of `ClangdLSPServer`'s fields(`FixItsMap` and `FixItsMutex`) being called before destructor of `Server`. It led to the worker thread calling `consumeDiagnostics` after `FixItsMutex` and `FixItsMap` destructors were called. Also, clangd is now run with '-run-synchronously' flag in 'formatting.test'. Reviewers: bkramer, krasimir Reviewed By: krasimir Subscribers: mgorny, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D33233 llvm-svn: 303151
* Revert "[ClangD] Refactor clangd into separate components"Adam Nemet2017-05-151-59/+0
| | | | | | | | | | This reverts commit r303067. Caused http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/34305/ And even after Simon's fix there is still a test failure. llvm-svn: 303094
* Revert "Fix windows buildbots - missing include and namespace"Adam Nemet2017-05-151-1/+0
| | | | | | | | | This reverts commit r303078. One test is still failing even after this: http://green.lab.llvm.org/green/job/clang-stage1-configure-RA_check/31374/consoleFull#18373900728254eaf0-7326-4999-85b0-388101f2d404 llvm-svn: 303093
* Fix windows buildbots - missing include and namespaceSimon Pilgrim2017-05-151-0/+1
| | | | llvm-svn: 303078
* [ClangD] Refactor clangd into separate componentsIlya Biryukov2017-05-151-0/+59
Summary: Major refactoring to split LSP implementation, Clang API calls and threading(mostly synchronization) Reviewers: bkramer, krasimir Reviewed By: bkramer Subscribers: cfe-commits, mgorny, klimek Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33047 llvm-svn: 303067
OpenPOWER on IntegriCloud