[PATCH] D63287: [clang-tidy] Make ClangTidyCheck::OptionsView public.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 13 10:33:58 PDT 2019


ymandel created this revision.
ymandel added a reviewer: gribozavr.
Herald added a subscriber: xazax.hun.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63287

Files:
  clang-tools-extra/clang-tidy/ClangTidyCheck.h


Index: clang-tools-extra/clang-tidy/ClangTidyCheck.h
===================================================================
--- clang-tools-extra/clang-tidy/ClangTidyCheck.h
+++ clang-tools-extra/clang-tidy/ClangTidyCheck.h
@@ -100,13 +100,6 @@
   /// 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 @@
     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(); }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63287.204579.patch
Type: text/x-patch
Size: 1169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190613/5290e9fb/attachment-0001.bin>


More information about the cfe-commits mailing list