summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [TEST] Fix test on Windows by looking for substrings rather than a regexDouglas Yung2019-06-191-4/+7
| | | | | | since the escaping of special characters appears to break on Windows. llvm-svn: 363761
* Fix more tests after r363749Aaron Puchert2019-06-191-0/+14
| | | | | | | Apparently -Wmissing-prototypes is used for quite a few integration tests. llvm-svn: 363760
* [clang-tidy] Split fuchsia-default-argumentsJulie Hockett2019-06-1813-113/+229
| | | | | | | | | | | | Splits fuchsia-default-arguments check into two checks. fuchsia-default-arguments-calls warns if a function or method is called with default arguments. fuchsia-default-arguments-declarations warns if a function or method is declared with default parameters. Committed on behalf of @diegoast (Diego Astiazarán). Resolves b38051. Differential Revision: https://reviews.llvm.org/D62437 llvm-svn: 363712
* [clangd] Return vector<TextEdit> from applyTweak. NFCIlya Biryukov2019-06-183-5/+19
| | | | | | | | | For the same reasons as r363150, which got overwritten by changes in r363680. Sending without review to unbreak our integrate. llvm-svn: 363691
* [clangd] Remove the extra ";", NFCHaojian Wu2019-06-181-2/+2
| | | | llvm-svn: 363681
* [clangd] Add hidden tweaks to dump AST/selection.Sam McCall2019-06-1814-53/+359
| | | | | | | | | | | | | | | | | | | | | | | Summary: This introduces a few new concepts: - tweaks have an Intent (they don't all advertise as refactorings) - tweaks may produce messages (for ShowMessage notification). Generalized Replacements -> Effect. - tweaks (and other features) may be hidden (clangd -hidden-features flag). We may choose to promote these one day. I'm not sure they're worth their own feature flags though. Verified it in vim-clangd (not yet open source), curious if the UI is ok in VSCode. Reviewers: ilya-biryukov Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62538 llvm-svn: 363680
* [clangd] Add a capability to enable completions with fixes.Sam McCall2019-06-183-0/+8
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63091 llvm-svn: 363664
* [clangd] Parse files without extensions if we don't have a compile command.Haojian Wu2019-06-182-2/+8
| | | | | | | | | | | | | | Summary: This would enable clangd for C++ standard library files. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63481 llvm-svn: 363663
* [clangd] Detect C++ language based on well-known file path in vscode extensionHaojian Wu2019-06-181-0/+4
| | | | | | | | | | | | | | | | | | | | Summary: Matching the "C++" pattern on the first line of the file doesn't cover all cases, MSVC C++ headers doesn't have such pattern. This patch introduce a new heuristic to detect language based on the file path. MSVC C++ standard headers are in the directory like "c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\include" Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63483 llvm-svn: 363662
* [clangd] Perform merge for main file symbols.Haojian Wu2019-06-172-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, we randomly pick one main file symbol in dynamic index, we may loose the ideal symbol (with definition location) in the index. It fixes the issue where sometimes we fail to go to the symbol definition, see: 1. call go-to-decl on Foo in Foo.cpp 2. jump to Foo.h, call go-to-def on Foo in Foo.h we can't go back to Foo.cpp -- because we open Foo.cpp, Foo.h in clangd, both files have Foo symbol (one with def&decl, one with decl only), we randomely choose one. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63425 llvm-svn: 363568
* [clangd] Bump vscode-clangd v0.0.15.Haojian Wu2019-06-171-1/+1
| | | | | | | CHANGELOG: - support detecting C++ language from first line (`-*- C++ -*-`) of the file. llvm-svn: 363555
* [clangd] Detect C++ for extension-less source files in vscode extensionHaojian Wu2019-06-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: Extend our extension to support detecting these files as C++ files based on the first line (`-*- C++ -*-`), it will make clangd work on C++ standard headers (e.g. iostream). We use the contributes.languages[1] to enrich the builtin VScode C++ support. [1]: https://code.visualstudio.com/api/references/contribution-points#contributes.languages Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63397 llvm-svn: 363554
* [docs] Fix another bot warning by adding a blank line to separate the ↵Don Hinton2019-06-161-0/+1
| | | | | | `option::` command from the text below. llvm-svn: 363520
* [docs] Fix a few problems with clang-tool docs to get the bots green again.Don Hinton2019-06-162-2/+4
| | | | llvm-svn: 363518
* [clangd] Type hierarchy subtypesNathan Ridge2019-06-167-38/+283
| | | | | | | | | | | | | | | | | Summary: This builds on the relations support added in D59407, D62459, D62471, and D62839 to implement type hierarchy subtypes. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58880 llvm-svn: 363506
* Fix gcc-05.4 bot failures caused by in r363481 "[clangd] Index API and ↵Don Hinton2019-06-161-1/+2
| | | | | | | | | | implementations for relations" Use std::make_tuple instead of initializer list to make gcc-5.4 happy. See https://reviews.llvm.org/D62839 for details. llvm-svn: 363504
* [clangd] Index API and implementations for relationsNathan Ridge2019-06-1524-143/+454
| | | | | | | | | | | | | | | | | Summary: This builds on the relations support added in D59407, D62459, and D62471 to expose relations in SymbolIndex and its implementations. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62839 llvm-svn: 363481
* [clangd] Bump vscode-clangd v0.0.14Haojian Wu2019-06-141-1/+1
| | | | | | | | | CHANGELOG: - use the vscode-buildin feature to detect language (rather than using file extensions), this fixes the extension not working on non-standard C++ files (e.g. via files.associations) llvm-svn: 363375
* [clangd] Don't maintain a list of c-family extensions in vscode extension.Haojian Wu2019-06-141-10/+11
| | | | | | | | | | | | | | | | Summary: There is no need to maintain this list by ourself, vscode already provides this feature. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63323 llvm-svn: 363372
* Test commitShaurya Gupta2019-06-141-1/+0
| | | | llvm-svn: 363365
* [clang-tidy] Make ClangTidyCheck::OptionsView public.Yitzhak Mandelbaum2019-06-131-7/+7
| | | | | | | | | | | | | | Summary: The `OptionsView` class is currently protected. This constraint prevents tidies from passing the OptionsView to, for example, a helper function. Similarly, TransformerClangTidyCheck cannot pass the `OptionsView` object to functions that generate `tooling::RewriteRule`s. The latter is needed to allow the definition of such rules to depend on the clang-tidy options, as demonstrated in the child revision. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63287 llvm-svn: 363296
* [clang-tidy] Made abseil-faster-strsplit-delimiter tests pass on C++17Dmitri Gribenko2019-06-132-19/+10
| | | | | | | | | | | | | | | | Reviewers: hokein, gribozavr Reviewed By: hokein, gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63253 Patch by Johan Vikström. llvm-svn: 363273
* [clang-tidy] Fixed abseil-time-subtraction to work on C++17Dmitri Gribenko2019-06-132-17/+36
| | | | | | | | | | | | | | | | Summary: Fixed abseil-time-subtraction to work on C++17 Reviewers: hokein, gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63261 Patch by Johan Vikström. llvm-svn: 363272
* [clang-tidy] Made abseil-upgrade-duration-conversions tests pass on c++17Dmitri Gribenko2019-06-132-9/+17
| | | | | | | | | | | | | | | | | | Summary: Made abseil-upgrade-duration-conversions tests pass on c++17 Reviewers: hokein, gribozavr Reviewed By: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63262 Patch by Johan Vikström. llvm-svn: 363270
* [clang-tidy] Fixed abseil-duration-unnecessary-conversion tests for c++17Dmitri Gribenko2019-06-132-5/+3
| | | | | | | | | | | | | | | | | | Summary: Fixed abseil-duration-unnecessary-conversion tests for c++17 Reviewers: hokein, gribozavr Reviewed By: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63263 Patch by Johan Vikström. llvm-svn: 363263
* [Clangd] Fixed clangd diagnostics priorityKadir Cetinkaya2019-06-132-14/+19
| | | | | | | | | | | | | | | | | | | | Summary: - Fixed diagnostics where zero width inserted ranges were being used instead of the whole token - Added unit tests Patch by @SureYeaah ! Reviewers: sammccall, kadircet Reviewed By: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D63222 llvm-svn: 363253
* [clangd] Treat lambdas as functions when preparing hover responseKadir Cetinkaya2019-06-132-19/+108
| | | | | | | | | | | | Reviewers: sammccall, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62814 llvm-svn: 363237
* [clangd] Return TextEdits from ClangdServer::applyTweakIlya Biryukov2019-06-123-9/+12
| | | | | | | | | | | | | | | | | | | | Summary: Instead of `tooling::Replacements`. So that embedders do not need to store the contents of the file. This also aligns better with `ClangdServer::rename`. Reviewers: kadircet, hokein Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63140 llvm-svn: 363150
* [clangd] Fix typo in GUARDED_BY()Nikolai Kosjar2019-06-121-1/+1
| | | | | | | | | | | | Reviewers: ilya-biryukov, kadircet, sammccall Subscribers: javed.absar, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63193 llvm-svn: 363139
* Fixed a crash in misc-redundant-expression ClangTidy checkerDmitri Gribenko2019-06-122-11/+31
| | | | | | | | | | | | | | Summary: It was trying to pass a dependent expression into constant evaluator. Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63188 llvm-svn: 363133
* [clang-tidy] Fix invalid read on destructionNikolai Kosjar2019-06-111-19/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...in case the clang tidy plugin is linked into the clang binary. Valgrind's memcheck reports: 8949== Invalid read ==8866== Invalid read of size 4 8866== at 0x164D248B: fetch_sub (atomic_base.h:524) 8866== by 0x164D248B: llvm::ThreadSafeRefCountedBase<clang::ast_matchers::internal::DynMatcherInterface>::Release() const (IntrusiveRefCntPtr.h:98) 8866== by 0x164CE16C: llvm::IntrusiveRefCntPtrInfo<clang::ast_matchers::internal::DynMatcherInterface>::release(clang::ast_matchers::internal::DynMatcherInterface*) (IntrusiveRefCntPtr.h:127) 8866== by 0x164C8D5C: llvm::IntrusiveRefCntPtr<clang::ast_matchers::internal::DynMatcherInterface>::release() (IntrusiveRefCntPtr.h:190) 8866== by 0x164C3B87: llvm::IntrusiveRefCntPtr<clang::ast_matchers::internal::DynMatcherInterface>::~IntrusiveRefCntPtr() (IntrusiveRefCntPtr.h:157) 8866== by 0x164BB4F1: clang::ast_matchers::internal::DynTypedMatcher::~DynTypedMatcher() (ASTMatchersInternal.h:341) 8866== by 0x164BB529: clang::ast_matchers::internal::Matcher<clang::QualType>::~Matcher() (ASTMatchersInternal.h:496) 8866== by 0xD7AE614: __cxa_finalize (cxa_finalize.c:83) 8866== by 0x164B3082: ??? (in /d2/llvm/8/qtc/builds/DebugShared/lib/libclangTidyModernizeModule.so.8) 8866== by 0x4010B72: _dl_fini (dl-fini.c:138) 8866== by 0xD7AE040: __run_exit_handlers (exit.c:108) 8866== by 0xD7AE139: exit (exit.c:139) 8866== by 0xD78CB9D: (below main) (libc-start.c:344) 8866== Address 0x19dd9bc8 is 8 bytes inside a block of size 16 free'd 8866== at 0x4C3123B: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 8866== by 0x1469BB99: clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl::~TrueMatcherImpl() (ASTMatchersInternal.cpp:126) 8866== by 0x1469BBC5: llvm::object_deleter<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl>::call(void*) (ManagedStatic.h:30) 8866== by 0x9ABFF26: llvm::ManagedStaticBase::destroy() const (ManagedStatic.cpp:72) 8866== by 0x9ABFF94: llvm::llvm_shutdown() (ManagedStatic.cpp:84) 8866== by 0x9A65232: llvm::InitLLVM::~InitLLVM() (InitLLVM.cpp:52) 8866== by 0x14B0C8: main (driver.cpp:323) 8866== Block was alloc'd at 8866== at 0x4C3017F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 8866== by 0x1469BB36: llvm::object_creator<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl>::call() (ManagedStatic.h:24) 8866== by 0x9ABFD99: llvm::ManagedStaticBase::RegisterManagedStatic(void* (*)(), void (*)(void*)) const (ManagedStatic.cpp:42) 8866== by 0x1469B5DF: llvm::ManagedStatic<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl, llvm::object_creator<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl>, llvm::object_deleter<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl> >::operator*() (ManagedStatic.h:67) 8866== by 0x14698F9D: clang::ast_matchers::internal::DynTypedMatcher::trueMatcher(clang::ast_type_traits::ASTNodeKind) (ASTMatchersInternal.cpp:195) 8866== by 0x164C9D3B: _ZNK5clang12ast_matchers8internal11TrueMatchercvNS1_7MatcherIT_EEINS_8QualTypeEEEv (ASTMatchersInternal.h:1247) 8866== by 0x16501458: __static_initialization_and_destruction_0(int, int) (LoopConvertCheck.cpp:48) 8866== by 0x16501976: _GLOBAL__sub_I_LoopConvertCheck.cpp (LoopConvertCheck.cpp:920) 8866== by 0x4010732: call_init (dl-init.c:72) 8866== by 0x4010732: _dl_init (dl-init.c:119) 8866== by 0x40010C9: ??? (in /lib/x86_64-linux-gnu/ld-2.27.so) Differential Revision: https://reviews.llvm.org/D63129 llvm-svn: 363068
* [clang-tidy] Fix typo in bugprone-string-constructor.Clement Courbet2019-06-112-4/+4
| | | | | | s/bigger then/bigger than/ llvm-svn: 363053
* Fixed google-readability-casting test to work in c++17Dmitri Gribenko2019-06-112-8/+16
| | | | | | | | | | | | | | | | | | Summary: Fixed google-readability-casting.cpp to get tests working in c++17 Reviewers: gribozavr, hokein Reviewed By: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63128 Patch by Shaurya Gupta. llvm-svn: 363047
* [clangd] Add missing header guard.Haojian Wu2019-06-111-0/+5
| | | | llvm-svn: 363037
* [clangd] Fix gcc warning by removing extra ";"Mikael Holmen2019-06-111-1/+1
| | | | llvm-svn: 363034
* [clangd] Remove old hidden -use-dex-index flagSam McCall2019-06-102-8/+1
| | | | llvm-svn: 362978
* [clangd] Revamp textDocument/onTypeFormatting.Sam McCall2019-06-1010-43/+774
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The existing implementation (which triggers on }) is fairly simple and has flaws: - doesn't trigger frequently/regularly enough (particularly in editors that type the } for you) - often reformats too much code around the edit - has jarring cases that I don't have clear ideas for fixing This implementation is designed to trigger on newline, which feels to me more intuitive than } or ;. It does have allow for reformatting after other characters - it has a basic behavior and a model for adding specialized behavior for particular characters. But at least initially I'd stick to advertising \n in the capabilities. This also handles comment splitting: when you insert a line break inside a line comment, it will make the new line into an aligned line comment. Working on tests, but want people to patch it in and try it - it's hard to see if "feel" is right purely by looking at a test. Reviewers: ilya-biryukov, hokein Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60605 llvm-svn: 362939
* [clangd] Stop marshalling/requiring FormattingOptions. We never did anything ↵Sam McCall2019-06-103-41/+15
| | | | | | with them. llvm-svn: 362934
* [clangd] Return empty results on spurious completion triggersIlya Biryukov2019-06-072-22/+18
| | | | | | | | | | | | | | | | | | | | | Summary: We currently return an error, this causes `coc.nvim` and VSCode to show an error message in the logs. Returning empty list of completions allows to avod the error message without altering other user-visible behavior. Reviewers: sammccall Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62999 llvm-svn: 362811
* [clang-tidy] Another attempt to fix misc-redundant-expression check.Haojian Wu2019-06-061-5/+6
| | | | | | Correct the fix of rL3627011, the isValueDependent guard was added in a wrong place in rL362701. llvm-svn: 362706
* [clang-tidy] Make the plugin honor NOLINTNikolai Kosjar2019-06-066-18/+211
| | | | | | | | | | | | | | | | | Instantiate a ClangTidyDiagnosticConsumer also for the plugin case and let it forward the diagnostics to the external diagnostic engine that is already in place. One minor difference to the clang-tidy executable case is that the compiler checks/diagnostics are referred to with their original name. For example, for -Wunused-variable the plugin will refer to the check as "-Wunused-variable" while the clang-tidy executable will refer to that as "clang-diagnostic- unused-variable". This is because the compiler diagnostics never reach ClangTidyDiagnosticConsumer. Differential Revision: https://reviews.llvm.org/D61487 llvm-svn: 362702
* [clang-tidy] Fix an assertion failure in misc-redundant-expression.Haojian Wu2019-06-062-1/+13
| | | | | | | | | | | | | | | | | Summary: The assertion "isIntegerConstantExpr" is triggered in the isIntegerConstantExpr(), we should not call it if the expression is value dependent. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62947 llvm-svn: 362701
* [clangd] Remove unused signature help quality signal. NFCIlya Biryukov2019-06-063-9/+3
| | | | | | | | ContainsActiveParameter is not used anywhere, set incorrectly (see the removed FIXME) and has no unit tests. Removing it to simplify the code. llvm-svn: 362686
* [clang-tidy] Fix make-unique tests on C++2a.Haojian Wu2019-06-063-70/+114
| | | | | | | | | | | | | | | | Summary: These test cases are illgal in C++2a ("new Foo{}" needs to see the default constructor), so move them to the C++14-only tests. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62845 llvm-svn: 362679
* android: add a close-on-exec check on pipe()George Burgess IV2019-06-068-0/+127
| | | | | | | | | | | On Android, pipe() is better to be replaced by pipe2() with O_CLOEXEC flag to avoid file descriptor leakage. Patch by Jian Cai! Differential Revision: https://reviews.llvm.org/D61967 llvm-svn: 362673
* android: add a close-on-exec check on pipe2()George Burgess IV2019-06-068-0/+165
| | | | | | | | | | | On Android, pipe2() is better to set O_CLOEXEC flag to avoid file descriptor leakage. Patch by Jian Cai! Differential Revision: https://reviews.llvm.org/D62049 llvm-svn: 362672
* [clangd] Minor cleanup. NFCIlya Biryukov2019-06-041-1/+0
| | | | | | Removed unused using declaration from TweakTests.cpp llvm-svn: 362517
* [clangd] Also apply adjustArguments when returning fallback commandsKadir Cetinkaya2019-06-042-2/+6
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62856 llvm-svn: 362496
* Fix -Wparentheses warning. NFCI.Simon Pilgrim2019-06-041-2/+2
| | | | llvm-svn: 362491
* Fix Wshadow warningSimon Pilgrim2019-06-041-2/+2
| | | | llvm-svn: 362489
OpenPOWER on IntegriCloud