summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] also filter out another possible diag from MS ASM syntaxSam McCall2019-12-091-2/+3
|
* Magic number checker shouldn't warn on user defined string literalsTibor Brunner2019-12-092-4/+31
| | | | Fixes a false positive brought up by PR40633.
* [clangd] Delete ctor initializers while moving functions out-of-lineKadir Cetinkaya2019-12-092-1/+61
| | | | | | | | | | | | | | | | | | | | Summary: Currently we only delete function body from declaration, in addition to that we should also drop ctor initializers. Unfortunately CXXConstructorDecl doesn't store the location of `:` before initializers, therefore we make use of token buffer to figure out where to start deletion. Fixes https://github.com/clangd/clangd/issues/220 Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71188
* [clangd] Delete default arguments while moving functions out-of-lineKadir Cetinkaya2019-12-092-10/+47
| | | | | | | | | | | | | | | | | | Summary: Only function declarations should have the default arguments. This patch makes sure we don't propogate those arguments to out-of-line definitions. Fixes https://github.com/clangd/clangd/issues/221 Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71187
* [clangd] Implement range patching heuristics for cross-file rename.Haojian Wu2019-12-093-2/+491
| | | | | | | | | | | | Reviewers: sammccall, ilya-biryukov Reviewed By: sammccall Subscribers: merge_guards_bot, MaskRay, jkorous, mgrang, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70594
* [clangd] Use expansion location when the ref is inside macros.Haojian Wu2019-12-093-4/+44
| | | | | | | | | | | | | | | | | | | | | Summary: Previously, xrefs has inconsistent behavior when the reference is inside macro body: - AST-based xrefs (for main file) uses the expansion location; - our index uses the spelling location; This patch makes our index use file locations for references, which is consistent with AST-based xrefs, and kythe as well. After this patch, memory usage of static index on LLVM increases ~5%. Reviewers: ilya-biryukov Subscribers: merge_guards_bot, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70480
* [clangd] Allow extract-to-function on regions that always return.Sam McCall2019-12-092-16/+91
| | | | | | | | | | | | | | Summary: We only do a trivial check whether the region always returns - it has to end with a return statement. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70569
* [Parser] Don't crash on MS assembly if target desc/asm parser isn't linked in.Sam McCall2019-12-093-1/+19
| | | | | | | | | | | | | | | | | | Summary: Instead, emit a diagnostic and return an empty ASM node, as we do if the target is missing. Filter this diagnostic out in clangd, where it's not meaningful. Fixes https://github.com/clangd/clangd/issues/222 Reviewers: kadircet Subscribers: mgorny, ilya-biryukov, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71189
* Reland "[AST] Traverse the class type loc inside the member type loc.""Haojian Wu2019-12-091-2/+2
| | | | | | | | | | | | Summary: added a unittest which causes "TL.getClassTInfo" is null. Reviewers: ilya-biryukov Subscribers: mgorny, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71186
* [clangd] Navigation from definition of template specialization to primary ↵Nathan Ridge2019-12-082-5/+32
| | | | | | | | | | | | | | template Fixes https://github.com/clangd/clangd/issues/212. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71090
* Optionally exclude bitfield definitions from magic numbers checkFlorin Iucha2019-12-076-8/+90
| | | | Adds the IgnoreBitFieldsWidths option to readability-magic-numbers.
* Use ASTDumper to dump the AST from clang-queryStephen Kelly2019-12-061-1/+6
| | | | | | | | | | | | | | | | | | | | Summary: This way, the output is not limited by the various API differences between the dump() member functions. For example, all dumps are now in color, while that used to be the case only for Decls and Stmts, but not Types. Additionally, while DynTypedNode::dump (which was used up to now) was limited to dumping only Decls, Stmts and Types, this makes clang-query support everything ASTNodeTraverser supports. Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62056
* Remove Expr.h include from ASTContext.h, NFCReid Kleckner2019-12-061-0/+1
| | | | | | | ASTContext.h is popular, prune its includes. Expr.h brings in Attr.h, which is also expensive. Move BlockVarCopyInit to Expr.h to accomplish this.
* [clang-tidy] Pass -faligned-allocation on the compiler command line toAkira Hatanaka2019-12-061-2/+2
| | | | | | | | | fix compile error The test was failing when run on OSes older than MacOSX10.14 because aligned deallocation functions are unavailable on older OSes. rdar://problem/57706710
* [clangd] Switch Hover.All to structured testsKadir Cetinkaya2019-12-062-430/+488
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70911
* [clangd] Store index::SymbolKind in HoverInfoKadir Cetinkaya2019-12-063-38/+37
| | | | | | | | | | | | | | | | | | Summary: LSP's SymbolKind has some shortcomings when it comes to C++ types, index::SymbolKind has more detailed info like Destructor, Parameter, MACRO etc. We are planning to make use of that information in our new Hover response, and it would be nice to display the Symbol type in full detail, rather than some approximation. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70723
* [clangd] Try to fix CompileCommandsTests on windows. NFCSam McCall2019-12-062-14/+21
|
* [clangd] Fix gcc warning about extra ";" [NFC]Mikael Holmen2019-12-061-1/+1
| | | | | | | | gcc complained with /data/repo/master/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp:326:30: warning: extra ';' [-Wpedantic] REGISTER_TWEAK(DefineOutline); ^
* [clang-tidy] Fix PR26274Alexander Kornienko2019-12-063-70/+137
| | | | | | | | | | | | | | | | | Summary: This commit fixes http://llvm.org/PR26274 in a simpler and more correct way than 4736d63f752f8d13f4c6a9afd558565c32119718 did. See https://reviews.llvm.org/D69855#1767089 for details. Reviewers: gribozavr, aaron.ballman, gribozavr2 Reviewed By: aaron.ballman, gribozavr2 Subscribers: gribozavr2, merge_guards_bot, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70974
* [clangd] (take 2) Try harder to find a plausible `clang` as argv0, ↵Sam McCall2019-12-0611-107/+390
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert "[AST] Traverse the class type loc inside the member type loc."Sterling Augustine2019-12-051-2/+2
| | | | | | | This reverts commit 7f93cb62280a73e3e899d49c45be8bfbac634b7d. The assertion at RecursiveASTVisitor.h:1169 fails when passed a TypeLocNode. Not sure if the correct fix is to use getTypeLocClass or something else.
* [clangd] Highlighting dependent types in more contextsNathan Ridge2019-12-052-1/+37
| | | | | | | | | | | | | | Fixes https://github.com/clangd/clangd/issues/214. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70746
* [clangd] Find reference to template parameter in 'sizeof...' expressionNathan Ridge2019-12-053-146/+180
| | | | | | | | | | | | | | Fixes https://github.com/clangd/clangd/issues/213. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70740
* [clangd] Simplify the code, NFC.Haojian Wu2019-12-054-5/+5
| | | | AST.getASTContext().getSourceManager() => AST.getSourceManager().
* [AST] Traverse the class type loc inside the member type loc.Haojian Wu2019-12-051-2/+2
| | | | | | | | | | | | | | | Summary: We are missing this currently. This would fix https://github.com/clangd/clangd/issues/216. Reviewers: ilya-biryukov Subscribers: mgorny, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70849
* [clangd] More unittests for cross-file rename.Haojian Wu2019-12-052-2/+153
| | | | | | | | | | | | | | | | | Summary: The previous unittests for cross-file rename was kind of weak. With this patch, we should have more test coverage, and it is easy to add more tests in the future. Reviewers: ilya-biryukov, kbobyrev Reviewed By: ilya-biryukov Subscribers: merge_guards_bot, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71050
* [clangd] Fix an incorrect comment, NFC.Haojian Wu2019-12-051-1/+1
|
* [clangd] Add xref for macro to static index.Utkarsh Saxena2019-12-053-49/+148
| | | | | | | | | | | | | | Summary: This adds the references for macros to the SymbolCollector (used for static index). Enabled if `CollectMacro` option is set. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70489
* [clangd] Add a tweak refactoring to wrap Objective-C string literals in ↵Alex Lorenz2019-12-043-0/+105
| | | | | | | | `NSLocalizedString` macros The commit adds a refactoring to Clangd that mimics the existing refactoring action in Xcode that wraps around an Objective-C string literal in an NSLocalizedString macro. Differential Revision: https://reviews.llvm.org/D69543
* [clangd] NFC, add getLangOpts helper to ParsedASTAlex Lorenz2019-12-0413-39/+35
| | | | | The addition of the helper is split out from https://reviews.llvm.org/D69543 as suggested by Kadir. I also updated the existing uses to use the new API.
* [clang-change-namespace] Change file pattern to be an anchored regexKadir Cetinkaya2019-12-041-1/+1
|
* [clangd] register cuda language activation event and activate for .cuh filesptaylor2019-12-042-12/+14
| | | | | | | | | | | | | | Patch by Paul Taylor! Reviewers: hokein Reviewed By: hokein Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70041
* [clangd] Remove the hanging lit exit-signal.test.Haojian Wu2019-12-041-32/+0
| | | | | | | | The test was introduced in https://github.com/llvm/llvm-project/commit/19ac0eaf07e60173baa7ee77fa11568c30b87455. The test keeps hanging after running "check-clangd", remove it now and will add it back later after investigations.
* [clangd] Add no delayed templates to outline testsKadir Cetinkaya2019-12-041-0/+3
|
* [clangd] Define out-of-line qualify function nameKadir Cetinkaya2019-12-042-9/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When moving function definitions to a different context, the function name might need a different spelling, for example in the header it might be: ``` namespace a { void foo() {} } ``` And we might want to move it into a context which doesn't have `namespace a` as a parent, then we must re-spell the function name, i.e: ``` void a::foo() {} ``` This patch implements a version of this which ignores using namespace declarations in the source file. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70656
* [clangd] Define out-of-line qualify return valueKadir Cetinkaya2019-12-042-24/+189
| | | | | | | | | | | | | | | | Summary: Return type might need qualification if insertion context doesn't have the same decls visible as the source context. This patch adds qualification for return value to cover such cases. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70535
* [clangd] Define out-of-line initial apply logicKadir Cetinkaya2019-12-043-4/+217
| | | | | | | | | | | | | | | | | | Summary: Initial implementation for apply logic, replaces function body with a semicolon in source location and copies the full function definition into target location. Will handle qualification of return type and function name in following patches to keep the changes small. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69298
* [clangd] Define out-of-line availability checksKadir Cetinkaya2019-12-045-2/+179
| | | | | | | | | | | | | | | | | | Summary: Initial availability checks for performing define out-of-line code action, which is a refactoring that will help users move function/method definitions from headers to implementation files. Proposed implementation only checks whether we have an interesting selection, namely function name or full function definition/body. Reviewers: hokein Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69266
* Reapply "Fix crash on switch conditions of non-integer types in templates"Elizabeth Andrews2019-12-032-2/+4
| | | | | | | | | | | | | | | | | | | | This patch reapplies commit 759948467ea. Patch was reverted due to a clang-tidy test fail on Windows. The test has been modified. There are no additional code changes. Patch was tested with ninja check-all on Windows and Linux. Summary of code changes: Clang currently crashes for switch statements inside a template when the condition is a non-integer field member because contextual implicit conversion is skipped when parsing the condition. This conversion is however later checked in an assert when the case statement is handled. The conversion is skipped when parsing the condition because the field member is set as type-dependent based on its containing class. This patch sets the type dependency based on the field's type instead. This patch fixes Bug 40982.
* [clangd] Fix comparator const after c9c714c7054d555398c767cb39d7d97600b3d9d1Sam McCall2019-12-031-1/+1
|
* Revert "Fix llvm-namespace-comment for macro expansions"Alexander Kornienko2019-12-034-179/+16
| | | | | This reverts commit 4736d63f752f8d13f4c6a9afd558565c32119718. This commit introduces a ton of false positives and incorrect fixes. See https://reviews.llvm.org/D69855#1767089 for details.
* Reland [clangd] Rethink how SelectionTree deals with macros and #includes.Sam McCall2019-12-034-153/+361
| | | | | | This reverts commit 905b002c139f039a32ab9bf1fad63d745d12423f. Avoid tricky (and invalid) comparator for std::set.
* Fix compatibility with python3 of clang-include-fixer.pyYannick Brehon2019-12-031-1/+1
| | | | | | | clang-include-fixer was recently updated to be python3-compatible. However, an exception handling clause was improperly using the deprecated `message` property of Exception classes, so the code was not yet entirely python3-compatible. Differential Revision: https://reviews.llvm.org/D70902
* [NFC] Slightly improve wording in the commentsKirill Bobyrev2019-12-031-18/+18
| | | | | | Reviewed by: hokein Differential Revision: https://reviews.llvm.org/D70943
* AvoidBindCheck.cpp: Fix unused variables warningHans Wennborg2019-12-031-2/+2
|
* AvoidBindCheck.cpp: Fix GCC 5.3 build errorsHans Wennborg2019-12-031-17/+17
| | | | | | | | | | | | | It was failing with: clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp:61:29: error: declaration of ‘clang::tidy::modernize::{anonymous}::CaptureMode clang::tidy::modernize::{anonymous}::BindArgument::CaptureMode’ [-fpermissive] CaptureMode CaptureMode = CM_None; ^ clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp:38:6: error: changes meaning of ‘CaptureMode’ from ‘enum clang::tidy::modernize::{anonymous}::CaptureMode’ [-fpermissive] enum CaptureMode { CM_None, CM_ByRef, CM_ByValue, CM_InitExpression }; ^
* [clang-tidy] Rewrite modernize-avoid-bind check.Zachary Turner2019-12-026-120/+911
| | | | | | | | | | | | | | | | | | | This represents largely a full re-write of modernize-avoid-bind, adding significant new functionality in the process. In particular: * Both boost::bind and std::bind are now supported * Function objects are supported in addition to functions * Member functions are supported * Nested calls are supported using capture-init syntax * std::ref() and boost::ref() are now recognized, and will capture by reference. * Rather than capturing with a global =, we now build up an individual capture list that is both necessary and sufficient for the call. * Fixits are supported in a much larger variety of scenarios than before. All previous tests pass under the re-write, but a large number of new tests have been added as well. Differential Revision: https://reviews.llvm.org/D70368
* Remove extraneous semicolon.Bill Wendling2019-12-021-1/+1
|
* Revert "[clangd] repair mac tests for 88bccded8fa1"Sam McCall2019-12-023-165/+22
| | | | Revert "[clangd] Try harder to find a plausible `clang` as argv0, particularly on Mac."
* [clangd] repair mac tests for 88bccded8fa1Sam McCall2019-12-022-8/+26
|
OpenPOWER on IntegriCloud