summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
* [clang-doc] Create a script to generate testsJulie Hockett2018-07-2024-1389/+1834
| | | | | | | | | Upstreaming the script I use to generate clang-doc tests (and updating the existing tests to use it) Differential Revision: https://reviews.llvm.org/D49268 llvm-svn: 337632
* [clang-doc] Adding PublicOnly flagJulie Hockett2018-07-2012-32/+528
| | | | | | | | | | | Submitted on behalf of Annie Cherkaev (@anniecherk) Added a flag which, when enabled, documents only those methods and fields which have a Public attribute. Differential Revision: https://reviews.llvm.org/D48395 llvm-svn: 337602
* [clangd] Fix racy use-after-scope in unittestBenjamin Kramer2018-07-201-2/+1
| | | | | | This only shows up with asan when the stars align in a bad way. llvm-svn: 337601
* [clangd] FuzzyMatch exposes an API for its word segmentation. NFCSam McCall2018-07-203-45/+81
| | | | | | | | | | | | Summary: This is intended to be used for indexing, e.g. in D49417 Reviewers: ioeric, omtcyfz Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D49540 llvm-svn: 337527
* [clangd] Also get scope for RK_pattern completion results.Eric Liu2018-07-182-2/+16
| | | | | | | For exmaple, clas field candidates in constructor initializers can be RK_Pattern, but they can still have scopes. llvm-svn: 337396
* [clang-tidy: modernize] Fix modernize-use-equals-default with {} brackets ↵Idriss Riouak2018-07-172-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | list initialization: patch Summary: Hello, i would like to suggest a fix for one of the checks in clang-tidy. The bug was reported in https://bugs.llvm.org/show_bug.cgi?id=38039 where you can find more information. ``` struct UOB{ UOB(const UOB &Other):j{Other.j}{} int j; }; ``` In this case the check modernize-use-equals-default does not detect copy constructors that can be defaulted; that should be: ``` struct UOB{ UOB(const UOB &Other) = default; int j; }; ``` Reviewers: aaron.ballman, hokein, alexfh Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49356 llvm-svn: 337286
* [clang-tidy] Force exceptions to be enabled in testBenjamin Kramer2018-07-141-1/+1
| | | | | | For targets that have them off by default. llvm-svn: 337091
* [Documentation] Add missing description for bugprone-exception-escape in ↵Eugene Zelenko2018-07-131-0/+3
| | | | | | Release Notes. llvm-svn: 337069
* [clang-tidy] Exception Escape CheckerAdam Balogh2018-07-138-0/+571
| | | | | | | | | | | Finds functions which may throw an exception directly or indirectly, but they should not: Destructors, move constructors, move assignment operators, the main() function, swap() functions, functions marked with throw() or noexcept and functions given as option to the checker. Differential Revision: https://reviews.llvm.org/D33537 llvm-svn: 336997
* [clang-tidy] readability-inconsistent-declaration-parameter-name: accept ↵Sam McCall2018-07-135-10/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | approximate name matches. Summary: The goal is to reduce false positives when the difference is intentional, like: foo(StringRef name); foo(StringRef name_ref) { string name = cleanup(name_ref); ... } Or semantically unimportant, like: foo(StringRef full_name); foo(StringRef name) { ... } There are other matching names we won't recognise (e.g. syns vs synonyms) but this catches many that we see in practice, and gives people a systematic workaround. The old behavior is available as a 'Strict' option. Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D49285 llvm-svn: 336992
* [clang-tidy/ObjC] Add SQL to list of acronymsBen Hamilton2018-07-121-0/+1
| | | | | | | | | | | | | | Summary: SQL is a common acronym. Reviewers: Wizard, hokein Reviewed By: Wizard, hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49190 llvm-svn: 336919
* [clangd] Extract FileSystemProvider into a separate header. NFCSam McCall2018-07-123-20/+43
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: mgorny, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D49142 llvm-svn: 336909
* [clangd] log request/response messages with method/ID/error at INFO levelSam McCall2018-07-121-8/+29
| | | | | | | | | | | | Summary: Bodies are logged at VERBOSE level (since r336785), tweak the formatting. Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D49224 llvm-svn: 336899
* [clangd] Simplify logging wrapper after r336888Sam McCall2018-07-121-14/+5
| | | | llvm-svn: 336890
* [Documentation] Fix incorrect documentation references, new checks order in ↵Eugene Zelenko2018-07-111-8/+8
| | | | | | Release Notes llvm-svn: 336850
* [Documentation] Link format and order of Clang-tidy changes in Release NotesEugene Zelenko2018-07-111-11/+10
| | | | llvm-svn: 336849
* [clangd] Uprank delcarations when "using q::name" is present in the main fileKirill Bobyrev2018-07-112-12/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | Having `using qualified::name;` for some symbol is an important signal for clangd code completion as the user is more likely to use such symbol. This patch helps to uprank the relevant symbols by saving UsingShadowDecl in the new field of CodeCompletionResult and checking whether the corresponding UsingShadowDecl is located in the main file later in ClangD code completion routine. While the relative importance of such signal is a subject to change in the future, this patch simply bumps DeclProximity score to the value of 1.0 which should be enough for now. The patch was tested using `$ ninja check-clang check-clang-tools` No unexpected failures were noticed after running the relevant testsets. Reviewers: sammccall, ioeric Subscribers: MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D49012 llvm-svn: 336810
* [clangd] Ignore sema code complete callback with recovery context.Eric Liu2018-07-112-3/+32
| | | | | | | | | | | | | | | | | | | Summary: Sema code complete in the recovery mode is generally useless. For many cases, sema first completes in recovery context and then recovers to more useful context, in which it's favorable to ignore results from recovery (as results are often bad e.g. all builtin symbols and top-level symbols). There is also case where only sema would fail to recover e.g. completions in excluded #if block. Sema would try to give results, but the results are often useless (see the updated excluded #if block test). Reviewers: sammccall, ilya-biryukov Subscribers: MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D49175 llvm-svn: 336801
* [clangd] Upgrade logging facilities with levels and formatv.Sam McCall2018-07-1120-110/+177
| | | | | | | | | | | | | | | | | | | | | | Summary: log() is split into four functions: - elog()/log()/vlog() have different severity levels, allowing filtering - dlog() is a lazy macro which uses LLVM_DEBUG - it logs to the logger, but conditionally based on -debug-only flag and is omitted in release builds All logging functions use formatv-style format strings now, e.g: log("Could not resolve URI {0}: {1}", URI, Result.takeError()); Existing log sites have been split between elog/log/vlog by best guess. This includes a workaround for passing Error to formatv that can be simplified when D49170 or similar lands. Subscribers: ilya-biryukov, javed.absar, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D49008 llvm-svn: 336785
* Use ExprMutationAnalyzer in performance-for-range-copyShuai Wang2018-07-102-3/+17
| | | | | | | | | | | | | | | | | | | | | Summary: This gives better coverage to the check as ExprMutationAnalyzer is more accurate comparing to isOnlyUsedAsConst. Majority of wins come from const usage of member field, e.g.: for (auto widget : container) { // copy of loop variable if (widget.type == BUTTON) { // const usage only recognized by ExprMutationAnalyzer // ... } } Reviewers: george.karpenkov Subscribers: a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D48854 llvm-svn: 336737
* [clangd] Make sure macro information exists before increasing usage count.Eric Liu2018-07-091-6/+4
| | | | llvm-svn: 336581
* [clangd] Support indexing MACROs.Eric Liu2018-07-093-25/+147
| | | | | | | | | | | | | | Summary: This is not enabled in the global-symbol-builder or dynamic index yet. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D49028 llvm-svn: 336553
* [clangd] Mark "Document Symbols" as implemented in the docsMarc-Andre Laperle2018-07-091-1/+1
| | | | | | | | | | Summary: Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48996 llvm-svn: 336550
* [clangd] Remove JSON library in favor of llvm/Support/JSONSam McCall2018-07-0914-1675/+245
| | | | | | | | | | | | | | | | | | | | Summary: The library has graduated from clangd to llvm/Support. This is a mechanical change to move to the new API and remove the old one. Main API changes: - namespace clang::clangd::json --> llvm::json - json::Expr --> json::Value - Expr::asString() etc --> Value::getAsString() etc - unsigned longs need a cast (due to r336541 adding lossless integer support) Reviewers: ilya-biryukov Subscribers: mgorny, ioeric, MaskRay, jkorous, omtcyfz, cfe-commits Differential Revision: https://reviews.llvm.org/D49077 llvm-svn: 336549
* [clangd] Do not write comments into Preamble PCHIlya Biryukov2018-07-092-32/+12
| | | | | | | | | | | | | | | | | | | | Summary: To avoid wasting time deserializing them on code completion and further reparses. We do not use the comments anyway, because we cannot rely on the file contents staying the same for reparses that reuse the prebuilt preamble PCH. Reviewers: sammccall Reviewed By: sammccall Subscribers: ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48943 llvm-svn: 336540
* [clangd] Wait for first preamble before code completionIlya Biryukov2018-07-093-0/+61
| | | | | | | | | | | | | | | | Summary: To avoid doing extra work of processing headers in the preamble mutilple times in parallel. Reviewers: sammccall Reviewed By: sammccall Subscribers: javed.absar, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48940 llvm-svn: 336538
* [clangd] Added a test for preambles and -isystemIlya Biryukov2018-07-091-0/+36
| | | | | | | | | | | | | | | | Summary: Checks that preambles are properly invalidated when headers from -isystem paths change. Reviewers: sammccall, ioeric Reviewed By: sammccall Subscribers: MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48947 llvm-svn: 336530
* [clangd] Make SymbolOrigin an enum class, rather than a plain enum.Sam McCall2018-07-065-16/+24
| | | | | | | I never intended to define namespace pollution like clangd::AST, clangd::Unknown etc. Oops! llvm-svn: 336431
* [clangd] Implementation of textDocument/documentSymbolMarc-Andre Laperle2018-07-0519-16/+512
| | | | | | | | | | | | | | | | | Summary: An AST-based approach is used to retrieve the document symbols rather than an in-memory index query. The index is not an ideal fit to achieve this because of the file-centric query being done here whereas the index is suited for project-wide queries. Document symbols also includes more symbols and need to keep the order as seen in the file. Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Subscribers: tomgr, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D47846 llvm-svn: 336386
* [clang-move] ClangMoveTests: Remove dots in output pathsSimon Marchi2018-07-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Following D48903 ([VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name), the paths output by clang-move in the FileToReplacements map may contain leading "./". For example, where we would get "foo.h", we'll now get "./foo.h". This breaks the tests, because we are doing exact string lookups in the FileToFileID and Results maps (they contain "foo.h", but we search for "./foo.h"). To mitigate this, try to normalize a little bit the paths output by clang-move to remove that leading "./". This patch should be safe to merge before D48903, remove_dots will just be a no-op. Reviewers: ilya-biryukov, hokein Reviewed By: hokein Subscribers: ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D48951 llvm-svn: 336358
* [NFS] Wipe trailing whitespacesKirill Bobyrev2018-07-051-62/+63
| | | | | | | | This patch is a preparation for another one containing meaningful changes. This patch simply removes trailing whitespaces in few files affected by the upcoming patch and reformats llvm-svn: 336330
* Fix -Wunused-variable warning. NFCI.Simon Pilgrim2018-07-051-1/+1
| | | | llvm-svn: 336329
* [clangd] Log sema completion context kind and query scopes. NFCEric Liu2018-07-051-2/+9
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48724 llvm-svn: 336321
* Revert "[clangd] FileDistance: temporarily disable in CodeComplete, it's ↵Sam McCall2018-07-051-2/+1
| | | | | | | | | behaving badly" The bad behavior seems to have been fixed by r336242 after all. I thought it was persisting, but that was a different bug fixed by D48940 llvm-svn: 336320
* [clangd] Treat class constructor as in the same scope as the class in ranking.Eric Liu2018-07-054-7/+52
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48933 llvm-svn: 336318
* [clangd] Track origins of symbols (various indexes, Sema).Sam McCall2018-07-0513-13/+85
| | | | | | | | | | | | Summary: Surface it in the completion items C++ API, and when a flag is set. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48938 llvm-svn: 336309
* Adding some documentation changes that were missed in r336301.Aaron Ballman2018-07-052-0/+42
| | | | llvm-svn: 336302
* Add the cert-msc51-cpp and cert-msc32-c checks.Aaron Ballman2018-07-058-0/+434
| | | | | | | | These checks flag use of random number generators with poor seeds that would possibly lead to degraded random number generation. Patch by Borsik Gábor llvm-svn: 336301
* [clang-tidy] Fix http://llvm.org/PR38055Alexander Kornienko2018-07-042-2/+18
| | | | llvm-svn: 336283
* [clangd] only ignore collected symbols if TU has uncompilable errors.Eric Liu2018-07-041-3/+4
| | | | llvm-svn: 336260
* [clang-tools-extra] Cleanup documentation routineKirill Bobyrev2018-07-042-1817/+14
| | | | | | | | | | | | | | | | | | | | | | | | The following issues are resolved: * Doxygen didn't generate documentation for a bunch of existing tools due to the absence of their directories in the doxygen configuration file. This patch adds all relevant directories to the appropriate list. * clang-tools-extra/docs/Doxyfile seems to be unused and irrelevant, doxygen.cfg.in is passed to the CMake's Doxygen invocation, hence Doxyfile is removed. The validity of proposed changes was manually checked by building doxygen-clang-tools and making sure that clangd and other tools are present in Doxygen-generated docs of clang-tools-extra. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47537 llvm-svn: 336257
* [clangd] Cleanup unittest: URIs. NFC.Eric Liu2018-07-041-2/+2
| | | | llvm-svn: 336253
* [clangd] Avoid collecting symbols from broken TUs in global-symbol-builder.Eric Liu2018-07-041-0/+8
| | | | | | | | | | | | | | Summary: For example, template parameter might not be resolved in a broken TU, which can result in wrong USR/SymbolID. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48881 llvm-svn: 336252
* Try to fix FileDistance test on windows.Eric Liu2018-07-041-2/+8
| | | | | | http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11510/steps/ninja%20check%201/logs/FAIL%3A%20Extra%20Tools%20Unit%20Tests%3A%3AFileDistanceTests.URI llvm-svn: 336249
* [clangd] FileDistance: temporarily disable in CodeComplete, it's behaving badlySam McCall2018-07-041-1/+2
| | | | llvm-svn: 336248
* [clangd] FileDistance: missing constexprSam McCall2018-07-041-1/+1
| | | | llvm-svn: 336246
* [clangd] FileDistance: don't add duplicate edgesSam McCall2018-07-041-1/+3
| | | | llvm-svn: 336242
* [clangd] Replace UniqueFunction with llvm::unique_function.Benjamin Kramer2018-07-039-84/+29
| | | | | | One implementation of this ought to be enough for everyone. llvm-svn: 336228
* [clangd] Use default format style and fallback style. NFCEric Liu2018-07-031-3/+3
| | | | llvm-svn: 336203
* [clangd] Incorporate transitive #includes into code complete proximity scoring.Sam McCall2018-07-0317-259/+653
| | | | | | | | | | | | | | | | | | | | | | | | Summary: We now compute a distance from the main file to the symbol header, which is a weighted count of: - some number of #include traversals from source file --> included file - some number of FS traversals from file --> parent directory - some number of FS traversals from parent directory --> child file/dir This calculation is performed in the appropriate URI scheme. This means we'll get some proximity boost from header files in main-file contexts, even when these are in different directory trees. This extended file proximity model is not yet incorporated in the index interface/implementation. Reviewers: ioeric Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48441 llvm-svn: 336177
OpenPOWER on IntegriCloud