summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Update TransformerClangTidyCheck to use new Transformer bindings.Yitzhak Mandelbaum2019-11-061-14/+13
| | | | | | | | | | | | | | Summary: Updates the relevant source files to use bindings in `clang::transformer` rather than `clang::tooling`. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69804
* [libTooling] Move Transformer files to their own directory/library.Yitzhak Mandelbaum2019-10-101-3/+3
| | | | | | | | | | | | | | | | | | | Summary: The Transformer library has been growing inside of lib/Tooling/Refactoring. However, it's not really related to anything else in that directory. This revision moves all Transformer-related files into their own include & lib directories. A followup revision will (temporarily) add forwarding headers to help any users migrate their code to the new location. Reviewers: gribozavr Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68637 llvm-svn: 374271
* [clang-tidy][NFC] Qualify `makeRule` call in test, for consistency with ↵Yitzhak Mandelbaum2019-08-261-2/+3
| | | | | | | | | | other calls. One call `makeRule` is unqualified (and unintentionally relying on ADL to resolve correctly). This revision qualifies that call for consistency and to drop use of ADL. llvm-svn: 369915
* [clang-tidy] TransformerClangTidyCheck: change choice of location for ↵Yitzhak Mandelbaum2019-08-261-4/+54
| | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message. Summary: This patch changes the location specified to the `ClangTidyCheck::diag()`. Currently, the beginning of the matched range is used. This patch uses the beginning of the first fix's range. This change both simplifies the code and (hopefully) gives a more intuitive result: the reported location aligns with the fix(es) provided, rather than the (arbitrary) range of the rule's match. N.B. this patch will break the line offset numbers in lit tests if the first fix is not at the beginning of the match. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66676 llvm-svn: 369914
* [clang-tidy] Extend TransformerClangTidyCheck to support adding includes.Yitzhak Mandelbaum2019-07-021-0/+49
| | | | | | | | | | | | | | | | | Summary: This revision implements support for the `AddedIncludes` field in RewriteRule cases; that is, it supports specifying the addition of include directives in files modified by the clang tidy check. Reviewers: ilya-biryukov, gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63893 llvm-svn: 364922
* [clang-tidy] Generalize TransformerClangTidyCheck to take a rule generator.Yitzhak Mandelbaum2019-06-261-3/+59
| | | | | | | | | | | | | | Summary: Tidy check behavior often depends on language and/or clang-tidy options. This revision allows a user of TranformerClangTidyCheck to pass rule _generator_ in place of a rule, where the generator takes both the language and clang-tidy options. Additionally, the generator returns an `Optional` to allow for the case where the check is deemed irrelevant/disable based on those options. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63288 llvm-svn: 364442
* [clang-tidy] In TransformerClangTidyCheck, require Explanation field.Yitzhak Mandelbaum2019-05-241-6/+9
| | | | | | | | | | | | | | | | | | | Summary: In general, the `Explanation` field is optional in `RewriteRule` cases. But, because the primary purpose of clang-tidy checks is to provide users with diagnostics, we assume that a missing explanation is a bug. This change adds an assertion that checks all cases for an explanation, and updates the code to rely on that assertion correspondingly. Reviewers: ilya-biryukov Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62340 llvm-svn: 361647
* [clang-tidy] Add support for writing a check as a Transformer rewrite rule.Yitzhak Mandelbaum2019-05-221-0/+68
This revision introduces an adaptor from Transformer's rewrite rules (`clang::tooling::RewriteRule`) to `ClangTidyCheck`. For example, given a RewriteRule `MyCheckAsRewriteRule`, it lets one define a tidy check as follows: ``` class MyTidyCheck : public TransformerClangTidyCheck { public: MyTidyCheck(StringRef Name, ClangTidyContext *Context) : TransformerClangTidyCheck(MyCheckAsRewriteRule, Name, Context) {} }; ``` Reviewers: aaron.ballman Subscribers: mgorny, xazax.hun, cfe-commits, ilya-biryukov Tags: #clang Differential Revision: https://reviews.llvm.org/D61386 llvm-svn: 361418
OpenPOWER on IntegriCloud