summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Index parameters in function declsKadir Cetinkaya2019-02-113-0/+12
| | | | | | | | | | | | Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57950 llvm-svn: 353696
* [clangd] Fix broken windows build bots.Kadir Cetinkaya2019-02-111-2/+2
| | | | llvm-svn: 353694
* [clangd] Make system header mappings available for PreambleParsedCallbackKadir Cetinkaya2019-02-112-5/+37
| | | | | | | | | | | | | | | | | | Summary: SystemHeaderMappings were added only after takeIncludes call, which resulted in getting mapping on main file ast updates but not on preamble ast updates. Fixes https://github.com/clangd/clangd/issues/8 Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58029 llvm-svn: 353687
* [clang-tidy] Don't use assignment for value-initialized enumsMalcolm Parsons2019-02-083-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The modernize-use-default-member-init check crashes when trying to create an assignment value for a value-initialized enum because it isn't a BuiltinType. An enum cannot be initialized by assigning 0 to it unless a cast is added. It could be initialized with an enumerator with the value 0, but there might not be one. Avoid these issues by ignoring the UseAssignment setting for value-initialized enums. Fixes PR35050. Reviewers: aaron.ballman, alexfh, JonasToth Reviewed By: JonasToth Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57852 llvm-svn: 353554
* [clang-tidy] Add options to bugprone-argument-comment to add missing ↵Paul Hoad2019-02-085-12/+354
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | argument comments to literals bugprone-argument-comment only supports identifying those comments which do not match the function parameter name This revision add 3 options to adding missing argument comments to literals (granularity on type is added to control verbosity of fixit) ``` CheckOptions: - key: bugprone-argument-comment.CommentBoolLiterals value: '1' - key: bugprone-argument-comment.CommentFloatLiterals value: '1' - key: bugprone-argument-comment.CommentIntegerLiterals value: '1' - key: bugprone-argument-comment.CommentStringLiterals value: '1' - key: bugprone-argument-comment.CommentCharacterLiterals value: '1' - key: bugprone-argument-comment.CommentUserDefinedLiterals value: '1' - key: bugprone-argument-comment.CommentNullPtrs value: '1' ``` After applying these options, literal arguments will be preceded with /*ParameterName=*/ Reviewers: JonasToth, Eugene.Zelenko, alexfh, hokein, aaron.ballman Reviewed By: aaron.ballman, Eugene.Zelenko Differential Revision: https://reviews.llvm.org/D57674 llvm-svn: 353535
* [clang-tidy][NFC] Fix typo.Yitzhak Mandelbaum2019-02-081-1/+1
| | | | | | Fix placement of comma from previous (test) commit. llvm-svn: 353525
* [clang-tidy][NFC] Test commit. Add missing comma.Yitzhak Mandelbaum2019-02-081-2/+2
| | | | llvm-svn: 353523
* [clangd] Fix an assertion in TypoCorrection.Eric Liu2019-02-082-6/+22
| | | | | | | | | | | | | | Summary: https://github.com/clangd/clangd/issues/7 Reviewers: sammccall, hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57944 llvm-svn: 353514
* [clangd] Mention indexing in docs.Kadir Cetinkaya2019-02-071-0/+19
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D57392 llvm-svn: 353423
* [clangd] Reduce number of threads used by BackgroundIndex to number of ↵Kadir Cetinkaya2019-02-071-5/+6
| | | | | | | | | | | | | | | | | | | | | | | physical cores. Summary: clangd is using as many threads as logical cores for BackgroundIndex by default. We observed that it increases latency of foreground tasks. This patch aims to change that default to number of physical cores to get rid of that extra latency. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57819 llvm-svn: 353422
* [clangd] Fix an assertion failure in Selection.Haojian Wu2019-02-072-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The assertion is triggered when the Decl is null. Details for the assertion: F0207 09:55:09.069385 47308 logging.cc:84] assert.h assertion failed at llvm/include/llvm/Support/Casting.h:105 in static bool llvm::isa_impl_cl<clang::TranslationUnitDecl, const clang:: Decl *>::doit(const From *) [To = clang::TranslationUnitDecl, From = const clang::Decl *]: Val && "isa<> used on a null pointer" 15 *** Check failure stack trace: *** 19 @ 0x55615c1f7e06 __assert_fail 20 @ 0x55615a6297d8 clang::clangd::(anonymous namespace)::SelectionVisitor::TraverseDecl() 21 @ 0x55615a62f48d clang::RecursiveASTVisitor<>::TraverseTemplateTemplateParmDecl() 22 @ 0x55615a62b264 clang::RecursiveASTVisitor<>::TraverseDecl() 23 @ 0x55615a62979c clang::clangd::(anonymous namespace)::SelectionVisitor::TraverseDecl() 24 @ 0x55615a63060c clang::RecursiveASTVisitor<>::TraverseClassTemplatePartialSpecializationDecl() 25 @ 0x55615a62ae45 clang::RecursiveASTVisitor<>::TraverseDecl() Reviewers: sammccall Subscribers: javed.absar, kristof.beyls, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57879 llvm-svn: 353421
* [ELF] Format lines inadvertently indented by rCTE353380Fangrui Song2019-02-071-5/+5
| | | | llvm-svn: 353415
* [clangd] Use Dex for dynamic index by default.Eric Liu2019-02-071-1/+1
| | | | | | | | | | | | | | | | | Summary: Memory usage for a sample TU: Without Dex: 17.9M With Dex: 24.4M The memory increase is considerable but seems tolerable. Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57878 llvm-svn: 353413
* [clang-tidy] Fixed a std::bind() transformationJonas Toth2019-02-072-1/+45
| | | | | | | | There was an extra semicolon that was somehow working in some contexts. Patch by oleg.smolsky. llvm-svn: 353389
* [clang-tidy] Expand and clarify the NOLINT documentation a bit.Alexander Kornienko2019-02-071-11/+32
| | | | llvm-svn: 353382
* [clangd] Suggest adding missing includes for typos (like include-fixer).Eric Liu2019-02-075-34/+329
| | | | | | | | | | | | | | | | | | | Summary: This adds include-fixer feature into clangd based on D56903. Clangd now captures diagnostics caused by typos and attach include insertion fixes to potentially fix the typo. Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits, kadircet, arphaman, mgrang, jkorous, MaskRay, javed.absar, ilya-biryukov, mgorny Tags: #clang Differential Revision: https://reviews.llvm.org/D57021 llvm-svn: 353380
* [clang-tidy] modernize-avoid-c-arrays: avoid main function (PR40604)Roman Lebedev2019-02-064-1/+50
| | | | | | | | | | | | | | | | | | | | | Summary: The check should ignore the main function, the program entry point. It is not possible to use `std::array<>` for the `argv`. The alternative is to use `char** argv`. Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=40604 | PR40604 ]] Reviewers: JonasToth, aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun, hans, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D57787 llvm-svn: 353327
* [clangd] Add type boost to fuzzy find in Dex.Eric Liu2019-02-067-50/+97
| | | | | | | | | | | | | | | | | | Summary: No noticeable impact on code completions overall except some improvement on cross-namespace completion. Reviewers: sammccall, ilya-biryukov Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57815 llvm-svn: 353310
* [clangd] Bump vscode-clangd v0.0.11Haojian Wu2019-02-061-1/+1
| | | | | | | CHANGELOG: - activate the extension on ObjC files. llvm-svn: 353309
* [clangd] Format tweak's replacements.Haojian Wu2019-02-069-13/+81
| | | | llvm-svn: 353306
* [clangd] Update dev dependencies of clangd-vscodeIlya Biryukov2019-02-063-5/+2031
| | | | | | | | | | | | | | | | | | | | | | Summary: The version bumps are a result of running `npm audit`, which found 3 security issues in previous versions of our dependencies. Also add 'package-lock.json' to the repo, it's a common practice to check in those files into the repository to get consistent versions of dependencies when running on different machines. Reviewers: hokein Reviewed By: hokein Subscribers: dschuff, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57814 llvm-svn: 353296
* [clangd] Enable clangd on Objective-C in VSCodeIlya Biryukov2019-02-061-1/+3
| | | | | | | | | | | | | | | | Summary: Thanks to Andreas Ostermeyer for raising this on the mailing list. Reviewers: hokein Reviewed By: hokein Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57813 llvm-svn: 353295
* [clangd] Add CLI flag "-clang-tidy" to enable/disable running clang-tidy checks.Haojian Wu2019-02-061-9/+18
| | | | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57746 llvm-svn: 353284
* [clangd] Some minor fixes.Haojian Wu2019-02-064-8/+7
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57755 llvm-svn: 353283
* [clang-tidy] Handle unions with existing default-member-initMalcolm Parsons2019-02-042-1/+11
| | | | | | | | | | | | | | | | | | | | Summary: clang-tidy's modernize-use-default-member-init was crashing for unions with an existing default member initializer. Fixes PR40492 Reviewers: aaron.ballman, alexfh, JonasToth Reviewed By: JonasToth Subscribers: JonasToth, riccibruno, xazax.hun, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D57665 llvm-svn: 353092
* [clang-tidy] Add the abseil-duration-unnecessary-conversion checkHyrum Wright2019-02-049-0/+206
| | | | | | Differential Revision: https://reviews.llvm.org/D57353 llvm-svn: 353079
* [clangd] Enable include insertion for static indexKadir Cetinkaya2019-02-0410-42/+125
| | | | | | | | | | | | | | Summary: This enables include insertion by adding canonical includes into preambledata. Reviewers: ioeric, ilya-biryukov Subscribers: javed.absar, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D57508 llvm-svn: 353054
* [clangd] Bump vscode-clangd v0.0.10Haojian Wu2019-02-041-1/+1
| | | | | | | | CHANGELOG: - cleanup filestatus caches when clangd crashes - extension workwith LSP v3.14.0, support go-to-declaration feature llvm-svn: 353027
* [clangd] Update vscode dependenciesHaojian Wu2019-02-041-3/+3
| | | | | | This allows us to use latest LSP v3.14.0 (for go-to-declaration feature). llvm-svn: 353026
* Remove trailing semicolon. NFCI.Simon Pilgrim2019-02-031-1/+1
| | | | llvm-svn: 352991
* Remove trailing semicolon. NFCI.Simon Pilgrim2019-02-031-1/+1
| | | | llvm-svn: 352990
* Revert rCTE352968 due to compilation failures 💥Stephane Moore2019-02-022-15/+3
| | | | llvm-svn: 352969
* [clang-tidy] Make google-objc-function-naming ignore implicit functions 🙈Stephane Moore2019-02-022-3/+15
| | | | | | | | | | | | | | | | | | Summary: Implicit functions are outside the control of source authors and should be exempt from style restrictions. Tested via running clang tools tests. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D57207 llvm-svn: 352968
* [clang-tidy] Rename time lookup functions; NFCHyrum Wright2019-02-023-7/+7
| | | | llvm-svn: 352964
* [clangd] Fix heap-use-after-free after r352868Eric Liu2019-02-021-5/+8
| | | | llvm-svn: 352957
* [Clangd] textDocument/definition and textDocument/declaration "bounce" ↵Sam McCall2019-02-022-15/+74
| | | | | | | | | | | | | | | | | | between definition and declaration location when they are distinct. Summary: This helps minimize the disruption of not returning declarations as part of a find-definition response (r352864). Reviewers: hokein Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, ilya-biryukov Tags: #clang Differential Revision: https://reviews.llvm.org/D57580 llvm-svn: 352953
* [clangd] Expose SelectionTree to code tweaks, and use it for swap if branches.Sam McCall2019-02-016-124/+84
| | | | | | | | | | | | | | | | | Summary: This reduces the per-check implementation burden and redundant work. It also makes checks range-aware by default (treating the commonAncestor as if it were a point selection should be good baseline behavior). Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet Tags: #clang Differential Revision: https://reviews.llvm.org/D57570 llvm-svn: 352876
* [clangd] Lib to compute and represent selection under cursor.Sam McCall2019-02-011-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The primary problem this solves is to expose the codeAction selection to AST-based refactorings in a way that makes it easy and efficient for them to bind to the right parts of the AST. It should also allow us to make XRefs based features (textDocument/definition) more robust, more easily implement textDocument/typeDefinition etc. As an example, template parameter references can be identified without special handling. There should be slight speedup too: we can prune most of the AST traversal in most cases. Elephant in the room: this is similar-but-different to Tooling/Refactoring/ASTSelection. That captures a smaller set of AST nodes, has a slightly different way of representing selections, and generally has mare features and does more work. The overall shape is pretty similar, and yet I can't quite get to behave as I expect. Reviewers: ilya-biryukov, kadircet Subscribers: mgorny, ioeric, MaskRay, jkorous, mgrang, arphaman Tags: #clang Differential Revision: https://reviews.llvm.org/D57562 llvm-svn: 352875
* [clangd] Lib to compute and represent selection under cursor.Sam McCall2019-02-015-0/+670
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The primary problem this solves is to expose the codeAction selection to AST-based refactorings in a way that makes it easy and efficient for them to bind to the right parts of the AST. It should also allow us to make XRefs based features (textDocument/definition) more robust, more easily implement textDocument/typeDefinition etc. As an example, template parameter references can be identified without special handling. There should be slight speedup too: we can prune most of the AST traversal in most cases. Elephant in the room: this is similar-but-different to Tooling/Refactoring/ASTSelection. That captures a smaller set of AST nodes, has a slightly different way of representing selections, and generally has mare features and does more work. The overall shape is pretty similar, and yet I can't quite get to behave as I expect. Reviewers: ilya-biryukov, kadircet Subscribers: mgorny, ioeric, MaskRay, jkorous, mgrang, arphaman Tags: #clang Differential Revision: https://reviews.llvm.org/D57562 llvm-svn: 352874
* [clangd] Penalize file-scope symbols in the ranking for non-completion queriesSam McCall2019-02-012-5/+28
| | | | | | | | Patch by Nathan Ridge! Differential Revision: https://reviews.llvm.org/D56653 llvm-svn: 352868
* [clangd] Implement textDocument/declaration from LSP 3.14Sam McCall2019-02-0112-231/+290
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: LSP now reflects the declaration/definition distinction. Language server changes: - textDocument/definition now returns a definition if one is found, otherwise the declaration. It no longer returns declaration + definition if they are distinct. - textDocument/declaration returns the best declaration we can find. - For macros, the active macro definition is returned for both methods. - For include directive, the top of the target file is returned for both. There doesn't appear to be a discovery mechanism (we can't return everything to clients that only know about definition), so this changes existing behavior. In practice, it should greatly reduce the fraction of the time we need to show the user a menu of options. C++ API changes: - findDefinitions is replaced by locateSymbolAt, which returns a vector<LocatedSymbol> - one for each symbol under the cursor. - this contains the preferred declaration, the definition (if found), and the symbol name This API enables some potentially-neat extensions, like swapping between decl and def, and exposing the symbol name to the UI in the case of multiple symbols. Reviewers: hokein Subscribers: ilya-biryukov, javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D57388 llvm-svn: 352864
* [clangd] Use delimited style to make life easier for the fuzzerSam McCall2019-02-011-1/+1
| | | | llvm-svn: 352863
* [clangd] Unbreak fuzzer targetSam McCall2019-02-011-1/+3
| | | | llvm-svn: 352857
* [clangd] clangDaemonTweaks - fix -DBUILD_SHARED_LIBS=ON buildRoman Lebedev2019-02-011-0/+9
| | | | | | Followup for rL352841. llvm-svn: 352843
* [clangd] Fix -DBUILD_SHARED_LIBS=ON build - SwapIfBranches needs clangAST.Roman Lebedev2019-02-011-0/+1
| | | | | | | | | | | | | | | Else, fails with: [1/2] Linking CXX executable bin/clangd FAILED: bin/clangd : && /usr/bin/g++ -pipe -O2 -g0 -UNDEBUG -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -pipe -O2 -g0 -UNDEBUG -fuse-ld=lld -Wl,--color-diagnostics -Wl,-allow-shlib-undefined -Wl,-O3 -Wl,--gc-sections tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/SwapIfBranches.cpp.o tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o -o bin/clangd -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMSupport.so.9svn -lpthread lib/libclangBasic.so.9svn lib/libclangTidy.so.9svn lib/libclangDaemon.so.9svn lib/libclangFormat.so.9svn lib/libclangFrontend.so.9svn lib/libclangSema.so.9svn lib/libclangTooling.so.9svn lib/libclangToolingCore.so.9svn && : ld.lld: error: undefined symbol: clang::FunctionDecl::getBody(clang::FunctionDecl const*&) const >>> referenced by SwapIfBranches.cpp >>> tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/SwapIfBranches.cpp.o:(clang::FunctionDecl::getBody() const) and so on. llvm-svn: 352841
* [clangd] Fix crash in applyTweak, remove TweakID alias.Sam McCall2019-02-016-25/+19
| | | | | | | Strings are complicated, giving them opaque names makes us forget they're complicated. llvm-svn: 352837
* [clangd] A code action to swap branches of an if statementIlya Biryukov2019-01-317-13/+401
| | | | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: llvm-commits, mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D56611 llvm-svn: 352796
* [clangd] Append "(fix available)" to diagnostic message when fixes are present.Eric Liu2019-01-319-13/+16
| | | | | | | | | | | | | | | | Summary: This would make diagnostic fixits more discoverable, especially for plugins like YCM. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D57509 llvm-svn: 352764
* [clang-tidy] refactor bugprone-exception-escape analysis into classJonas Toth2019-01-315-151/+223
| | | | | | | | | | | | | | | | | | | | | | Summary: The check `bugprone-exception-escape` does an AST-based analysis to determine if a function might throw an exception and warns based on that information. The analysis part is refactored into a standalone class similiar to `ExprMutAnalyzer` that is generally useful. I intent to use that class in a new check to automatically introduce `noexcept` if possible. Reviewers: aaron.ballman, alexfh, hokein, baloghadamsoftware, lebedev.ri Reviewed By: baloghadamsoftware, lebedev.ri Subscribers: lebedev.ri, mgorny, xazax.hun, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D57100 llvm-svn: 352741
* [clangd] Drop fixes if replying with tweaks resulted in an errorIlya Biryukov2019-01-302-9/+3
| | | | | | | | | | This should not happen in normal operation, as it implies that the diagnostics with some available fixes were produced but the AST is invalid. Moreover, the code had an error: always returned code actions ignoring the SupportsCodeAction capability and writing a test for this is impossible, since this can only happen due to programmer's error rather than invalid inputs. llvm-svn: 352624
OpenPOWER on IntegriCloud