[clang-tools-extra] r363296 - [clang-tidy] Make ClangTidyCheck::OptionsView public.

Yitzhak Mandelbaum via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 13 12:05:03 PDT 2019


Author: ymandel
Date: Thu Jun 13 12:05:02 2019
New Revision: 363296

URL: http://llvm.org/viewvc/llvm-project?rev=363296&view=rev
Log:
[clang-tidy] Make ClangTidyCheck::OptionsView public.

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

Modified:
    clang-tools-extra/trunk/clang-tidy/ClangTidyCheck.h

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyCheck.h?rev=363296&r1=363295&r2=363296&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyCheck.h Thu Jun 13 12:05:02 2019
@@ -100,13 +100,6 @@ public:
   /// whether it has the default value or it has been overridden.
   virtual void storeOptions(ClangTidyOptions::OptionMap &Options) {}
 
-private:
-  void run(const ast_matchers::MatchFinder::MatchResult &Result) override;
-  StringRef getID() const override { return CheckName; }
-  std::string CheckName;
-  ClangTidyContext *Context;
-
-protected:
   /// \brief Provides access to the ``ClangTidyCheck`` options via check-local
   /// names.
   ///
@@ -181,6 +174,13 @@ protected:
     const ClangTidyOptions::OptionMap &CheckOptions;
   };
 
+private:
+  void run(const ast_matchers::MatchFinder::MatchResult &Result) override;
+  StringRef getID() const override { return CheckName; }
+  std::string CheckName;
+  ClangTidyContext *Context;
+
+protected:
   OptionsView Options;
   /// \brief Returns the main file name of the current translation unit.
   StringRef getCurrentMainFile() const { return Context->getCurrentFile(); }




More information about the cfe-commits mailing list