@@ -149,6 +149,9 @@ After choosing the module and the name for the check, run the
149149``clang-tidy/add_new_check.py `` script to create the skeleton of the check and
150150plug it to :program: `clang-tidy `. It's the recommended way of adding new checks.
151151
152+ By default, the new check will apply only to C++ code. If it should apply under
153+ different language options, use the ``--language `` script's parameter.
154+
152155If we want to create a `readability-awesome-function-names `, we would run:
153156
154157.. code-block :: console
@@ -171,9 +174,7 @@ Let's see in more detail at the check class definition:
171174
172175 #include "../ClangTidyCheck.h"
173176
174- namespace clang {
175- namespace tidy {
176- namespace readability {
177+ namespace clang::tidy: :readability {
177178
178179 ...
179180 class AwesomeFunctionNamesCheck : public ClangTidyCheck {
@@ -182,11 +183,12 @@ Let's see in more detail at the check class definition:
182183 : ClangTidyCheck(Name, Context) {}
183184 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
184185 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
186+ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
187+ return LangOpts.CPlusPlus;
188+ }
185189 };
186190
187- } // namespace readability
188- } // namespace tidy
189- } // namespace clang
191+ } // namespace clang::tidy: :readability
190192
191193 ...
192194
@@ -231,9 +233,6 @@ override the method ``registerPPCallbacks``. The ``add_new_check.py`` script
231233does not generate an override for this method in the starting point for your
232234new check.
233235
234- If your check applies only under a specific set of language options, be sure
235- to override the method ``isLanguageVersionSupported `` to reflect that.
236-
237236Check development tips
238237----------------------
239238
0 commit comments