summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Fix header-guard check for include insertion, and don't index ↵Sam McCall2019-05-035-43/+84
| | | | | | | | | | | | | | | | | | | | | header guards. Summary: Both of these attempt to check whether a header guard exists while parsing the file. However the file is only marked as guarded once clang finishes processing it. We defer the checks and work until SymbolCollector::finish(). This is ugly and ad-hoc, deferring *all* work might be cleaner. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61442 llvm-svn: 359880
* [clangd] Also perform merging for symbol definitionsKadir Cetinkaya2019-05-032-17/+33
| | | | | | | | | | | | | | | | | | Summary: clangd currently prefers declarations from codegen files. This patch implements that behavior for definition locations. If we have definiton locations both coming from AST and index, clangd will perform a merging to show the codegen file if that's the case. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61126 llvm-svn: 359874
* [clangd] Minor code style cleanups in Protocol.h. NFCIlya Biryukov2019-05-031-6/+5
| | | | | | | | | | - Remove a parameter name that was misspelled (OS used for non-stream parameter) - Declare operator == (TextEdit, TextEdit) outside the struct, for consistency with other user-declared ops in our code. - Fix naming style of a parameter. llvm-svn: 359866
* [clangd][xpc] Cannonicalize value of CLANGD_BUILD_XPC before cachingJan Korous2019-05-021-0/+2
| | | | llvm-svn: 359824
* Reapply r359778: [clangd] Fix code completion of macros defined in the ↵Sam McCall2019-05-025-13/+97
| | | | | | | | | preamble region of the main file. The bad assert has been removed, and updateOutOfDateIdentifier has been guarded. This reverts commit r359796. llvm-svn: 359799
* Revert rL359778 : [clangd] Fix code completion of macros defined in the ↵Simon Pilgrim2019-05-025-97/+13
| | | | | | | | | | | | | | | | | | | | | | preamble region of the main file. Summary: This is a tricky case (we baked the assumption that symbols come from the preamble xor mainfile pretty deeply) and the fix is a bit of a hack: We look at the code to guess the macro names, and deserialize them from the preamble "by hand". Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60937 ........ Fix buildbots http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/47684/ llvm-svn: 359796
* [clangd] Fix code completion of macros defined in the preamble region of the ↵Sam McCall2019-05-025-13/+97
| | | | | | | | | | | | | | | | | | | | main file. Summary: This is a tricky case (we baked the assumption that symbols come from the preamble xor mainfile pretty deeply) and the fix is a bit of a hack: We look at the code to guess the macro names, and deserialize them from the preamble "by hand". Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60937 llvm-svn: 359778
* [clangd] Improvements to header mapping: more precise parsing of ↵Sam McCall2019-05-023-15/+105
| | | | | | | | | | | | | | | | | | | | | | cppreference symbol pages. Summary: Previously we were just jumping from the symbol index to the symbol page, and grabbing all the headers mentioned there. But the page often lists multiple symbols, and so we got false positives and thus ambiguities (which were dropped). Now we look at which declarations are for the symbol we want, and prefer headers listed above that symbol. If there are none, we fall back to the old behavior. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61316 llvm-svn: 359771
* [clangd] Standard library mapping: prefer "primary" versions of functions ↵Sam McCall2019-05-023-9/+54
| | | | | | | | | | | | | | over variants. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61349 llvm-svn: 359770
* [clangd] Restore conventional names for lit configs, and .in/.py split. Fix ↵Sam McCall2019-05-027-40/+76
| | | | | | build_mode indirection. llvm-svn: 359763
* [clangd] Delete an unused declarationFangrui Song2019-05-011-3/+0
| | | | llvm-svn: 359674
* [clangd] gen_std uses multiprocessing pool to be fast. While here, log ↵Sam McCall2019-04-301-24/+42
| | | | | | ambiguous symbols. NFC llvm-svn: 359564
* Fix Wpedantic "default argument specified for lambda parameter" warning. NFCI.Simon Pilgrim2019-04-301-3/+3
| | | | llvm-svn: 359548
* [clangd][xpc] Fix XPC unittestsJan Korous2019-04-292-1/+3
| | | | | | | | | Fix build after recent changes in clangd tests & add xpc unittests to check-clangd target. Differential Revision: https://reviews.llvm.org/D61271 llvm-svn: 359489
* [clangd] Fix serialization logic for Origin and Flags.Kadir Cetinkaya2019-04-292-5/+6
| | | | llvm-svn: 359470
* [clangd] Add separate unit tests for CanonicalIncludes. NFCSam McCall2019-04-293-35/+66
| | | | llvm-svn: 359455
* [clangd] Fix unittests CMake rulesSam McCall2019-04-292-4/+5
| | | | llvm-svn: 359442
* [clangd] Fix windows buildbot, remove stray file after r359424. NFCSam McCall2019-04-291-0/+1
| | | | llvm-svn: 359434
* [clangd] Surface diagnostics from headers inside main fileKadir Cetinkaya2019-04-295-19/+198
| | | | | | | | | | | | Reviewers: ioeric, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59302 llvm-svn: 359432
* [clangd] Move clangd tests to clangd directory. check-clangd is no longer ↵Sam McCall2019-04-29108-2/+19192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | part of check-clang-tools. Summary: Motivation: - this layout is a pain to work with - without a common root, it's painful to express things like "disable clangd" (D61122) - CMake/lit configs are a maintenance hazard, and the more the one-off hacks for various tools are entangled, the more we see apathy and non-ownership. This attempts to use the bare-minimum configuration needed (while still supporting the difficult cases: windows, standalone clang build, dynamic libs). In particular the lit.cfg.py and lit.site.cfg.py.in are merged into lit.cfg.in. The logic in these files is now minimal. (Much of clang-tools-extra's lit configs can probably be cleaned up by reusing lit.llvm.llvm_config.use_clang(), and every llvm project does its own version of LDPATH mangling. I haven't attempted to fix any of those). Docs are still in clang-tools-extra/docs, I don't have any plans to touch those. Reviewers: gribozavr Subscribers: mgorny, javed.absar, MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits, ilya-biryukov, thakis Tags: #clang Differential Revision: https://reviews.llvm.org/D61187 llvm-svn: 359424
* [clangd] Remove unused ClangdServer::dynamicIndex(). NFCIlya Biryukov2019-04-261-4/+0
| | | | llvm-svn: 359291
* [clangd] Query index in code completion no-compile mode.Sam McCall2019-04-263-19/+251
| | | | | | | | | | | | | | Summary: We scrape the enclosing scopes from the source file, and use them in the query. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61077 llvm-svn: 359284
* [clangd] Optimize "don't include me" check.Sam McCall2019-04-252-7/+34
| | | | | | | | | | | | | | | | Summary: llvm::Regex is really slow, and regex evaluation during preamble indexing was showing up as 25% on a profile of clangd in a codebase with large preambles. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61120 llvm-svn: 359214
* [clangd] Use JSON streaming API for Trace rather than pasting strings. NFCSam McCall2019-04-251-16/+18
| | | | llvm-svn: 359202
* [clangd] Support dependent bases in type hierarchyFangrui Song2019-04-221-8/+37
| | | | | | | | | | | | Patch by Nathan Ridge! Dependent bases are handled heuristically, by replacing them with the class template that they are a specialization of, where possible. Care is taken to avoid infinite recursion. Differential Revision: https://reviews.llvm.org/D59756 llvm-svn: 358866
* [CodeComplete] Remove obsolete isOutputBinary().Sam McCall2019-04-181-4/+2
| | | | | | | | | | | | | | | | Summary: It's never set to true. Its only effect would be to set stdout to binary mode. Hopefully we have better ways of doing this by now :-) Reviewers: hokein Subscribers: jkorous, arphaman, kadircet, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60871 llvm-svn: 358696
* [clangd] Support relatedInformation in diagnostics.Sam McCall2019-04-185-44/+107
| | | | | | | | | | | | | | Summary: We already have the structure internally, we just need to expose it. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60267 llvm-svn: 358675
* [clangd] Use llvm::set_thread_priority in background-indexKadir Cetinkaya2019-04-185-53/+31
| | | | | | | | | | | | Reviewers: gribozavr Subscribers: krytarowski, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60865 llvm-svn: 358664
* [clangd] Emit better error messages when rename fails.Haojian Wu2019-04-181-5/+17
| | | | | | | | | | | | | | | | Summary: Currently we emit an unfriendly "clang diagnostic" message when rename fails. This patch makes clangd to emit a detailed diagnostic message. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60821 llvm-svn: 358658
* [clangd] Log verbosely (LSP bodies) in lit tests. NFCSam McCall2019-04-181-1/+2
| | | | llvm-svn: 358655
* [clangd] Strip the ' [some-check-name]' suffix from clang-tidy diagnostics. ↵Sam McCall2019-04-171-0/+11
| | | | | | | | | | | | | | The check name is reported in Diagnostic.code. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60819 llvm-svn: 358612
* [clangd] Use shorter, more recognizable codes for diagnostics.Sam McCall2019-04-171-1/+11
| | | | | | | | | | | | | | | | | | | | | Summary: - for warnings, use the flag the warning is controlled by (-Wfoo) - for errors, keep using the internal name (there's nothing better) but drop the err_ prefix This comes at the cost of uniformity, it's no longer totally obvious exactly what the code field contains. But the -Wname flags are so much more useful to end-users than the internal warn_foo that this seems worth it. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60822 llvm-svn: 358611
* [clangd] Recognize "don't include me directly" pattern, and suppress include ↵Sam McCall2019-04-172-47/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | insertion. Summary: Typically used with umbrella headers, e.g. GTK: #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) #error "Only <gtk/gtk.h> can be included directly." #endif Heuristic is fairly conservative, a quick code search over github showed a fair number of hits and few/no false positives. (Not all were umbrella headers, but I'd be happy avoiding include insertion for all of them). We may want to relax the heuristic later to catch more cases. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60815 llvm-svn: 358605
* [clangd] Include textual diagnostic ID as Diagnostic.code.Sam McCall2019-04-175-19/+76
| | | | | | | | | | | | Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58291 llvm-svn: 358575
* [clangd] Include insertion: require header guards, drop other heuristics, ↵Sam McCall2019-04-173-51/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | treat .def like .inc. Summary: We do have some reports of include insertion behaving badly in some codebases. Requiring header guards both makes sense in principle, and is likely to disable this "nice-to-have" feature in codebases where headers don't follow the expected pattern. With this we can drop some other heuristics, such as looking at file extensions to detect known non-headers - implementation files have no guards. One wrinkle here is #import - objc headers may not have guards because they're intended to be used via #import. If the header is the main file or is #included, we won't collect locations - merge should take care of this if we see the file #imported somewhere. Seems likely to be OK. Headers which have a canonicalization (stdlib, IWYU) are exempt from this check. *.inc files continue to be handled by looking up to the including file. This patch also adds *.def here - tablegen wants this pattern too. In terms of code structure, the division between SymbolCollector and CanonicalIncludes has shifted: SymbolCollector is responsible for more. This is because SymbolCollector has all the SourceManager/HeaderSearch access needed for checking for guards, and we interleave these checks with the *.def checks in a loop (potentially). We could hand all the info into CanonicalIncludes and put the logic there if that's preferable. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60316 llvm-svn: 358571
* [clangd] lower_bound -> bsearch, NFCSam McCall2019-04-172-8/+8
| | | | llvm-svn: 358561
* clangd: Change Windows.h to windows.h.Peter Collingbourne2019-04-171-1/+1
| | | | | | This makes the file more cross compilation friendly. llvm-svn: 358549
* [clangd] Check file path of declaring header when deciding whether to insert ↵Eric Liu2019-04-164-21/+22
| | | | | | | | | | | | | | | | | | | include. Summary: Previously, we would use include spelling of the declaring header to check whether the inserted header is the same as the main file. This doesn't help because we only have file path of the main file. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60687 llvm-svn: 358496
* [clangd] Fallback to OrigD when SLoc is invalidKadir Cetinkaya2019-04-151-0/+6
| | | | | | | | | | | | | | | | | Summary: Some implicit/built-in decls lack the source location information. Fallback to OrigD that we've seen in the source code instead of the canonical one in those cases. Reviewers: sammccall Subscribers: cfe-commits, arphaman, jkorous, MaskRay, ioeric, ilya-biryukov Tags: #clang Differential Revision: https://reviews.llvm.org/D60689 llvm-svn: 358413
* [clangd] Wait for compile command in ASTWorker instead of ClangdServerEric Liu2019-04-156-68/+103
| | | | | | | | | | | | | | | | | | Summary: This makes addDocument non-blocking and would also allow code completion (in fallback mode) to run when worker waits for the compile command. Reviewers: sammccall, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: javed.absar, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60607 llvm-svn: 358400
* [clangd] Bump clangd-index version for TemplateArgument changesKadir Cetinkaya2019-04-151-1/+1
| | | | llvm-svn: 358383
* [clangd] Enable clang-tidy by default.Haojian Wu2019-04-121-1/+1
| | | | | | | | | | | | | | | | | | | Summary: We have turned on the flag internally for a while, and we don't receive complains. Should be good to turn it on now. If the projects doesn't have .clang-tidy files, no clang-tidy check will be run. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60560 llvm-svn: 358282
* [clangd] Show template argument list in workspacesymbols and documentsymbols ↵Kadir Cetinkaya2019-04-123-19/+2
| | | | | | | | | | | | | | | | | | responses Summary: Last part of re-landing rC356541. Puts TemplateArgumentsList into responses of the above mentioned two requests. Reviewers: ioeric, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59641 llvm-svn: 358274
* [clangd] Add TemplateArgumentList into SymbolKadir Cetinkaya2019-04-124-1/+12
| | | | | | | | | | | | | | | | | | | | | Summary: Part of re-landing rC356541 with D59599. Changes the way we store template arguments, previous patch was storing them inside Name field of Symbol. Which was violating the assumption: ```Symbol::Scope+Symbol::Name == clang::clangd::printQualifiedName``` which was made in multiple places inside codebase. This patch instead moves those arguments into their own field. Currently the field is meant to be human-readable, can be made structured if need be. Reviewers: ioeric, ilya-biryukov, gribozavr Subscribers: MaskRay, jkorous, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59640 llvm-svn: 358273
* [clangd] Print template arguments helperKadir Cetinkaya2019-04-122-14/+58
| | | | | | | | | | | | | | | | Summary: Prepares ground for printing template arguments as written in the source code, part of re-landing rC356541 with D59599 applied. Reviewers: ioeric, ilya-biryukov Subscribers: mgorny, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59639 llvm-svn: 358272
* [clangd] Use identifiers in file as completion candidates when build is not ↵Eric Liu2019-04-1110-74/+200
| | | | | | | | | | | | | | | | | | | | | | ready. Summary: o Lex the code to get the identifiers and put them into a "symbol" index. o Adds a new completion mode without compilation/sema into code completion workflow. o Make IncludeInserter work even when no compile command is present, by avoiding inserting non-verbatim headers. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60126 llvm-svn: 358159
* [clangd] Include compile command heuristic in logsSam McCall2019-04-111-1/+2
| | | | llvm-svn: 358157
* clangd-fuzzer: repair the buildSaleem Abdulrasool2019-04-101-1/+2
| | | | | | The inclusion of private headers of clangd percolates into the fuzzer. llvm-svn: 358127
* clangd: fix the build with XPCSaleem Abdulrasool2019-04-101-0/+1
| | | | | | | | | | | `Transport.h` does not include `Features.inc`. However, since it is used in a subdirectory, it cannot directly include the header as it is not available. Include `Features.inc` in `ClangdLSPServer.h` prior to the inclusion of `Transport.h` which will provide the interfaces in `ClangdMain.cpp` where the symbol `newXPCTransport` will not be defined due to it being preprocessed away since the configuration is not passed along to the initial inclusion. llvm-svn: 358103
* [clangd] Fix non-indexing of builtin functions like printf when the TU is CSam McCall2019-04-101-3/+3
| | | | llvm-svn: 358098
OpenPOWER on IntegriCloud