summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-09-27 21:47:01 +0000
committerAlexander Kornienko <alexfh@google.com>2014-09-27 21:47:01 +0000
commit04e9d9ce64d5e5ea90ee3c4e3fb3375984ca5483 (patch)
tree26c4dbc88692d5bc95738e92242ccb9d72fc458e
parent9d32634c617800828cb8372040f79c876eb46b80 (diff)
downloadbcm5719-llvm-04e9d9ce64d5e5ea90ee3c4e3fb3375984ca5483.tar.gz
bcm5719-llvm-04e9d9ce64d5e5ea90ee3c4e3fb3375984ca5483.zip
[clang-tidy] Updated documentation
Added an example of check-specific options. llvm-svn: 218573
-rw-r--r--clang-tools-extra/docs/clang-tidy.rst21
1 files changed, 18 insertions, 3 deletions
diff --git a/clang-tools-extra/docs/clang-tidy.rst b/clang-tools-extra/docs/clang-tidy.rst
index a0d7d90f982..c4176e13b9b 100644
--- a/clang-tools-extra/docs/clang-tidy.rst
+++ b/clang-tools-extra/docs/clang-tidy.rst
@@ -374,18 +374,33 @@ the check implements and what the current values are (e.g. for the
.. code-block:: c++
class MyCheck : public ClangTidyCheck {
- const unsigned SomeOption;
+ const unsigned SomeOption1;
+ const std::string SomeOption2;
public:
MyCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- SomeOption(Options.get("SomeOption", -1U)) {}
+ SomeOption(Options.get("SomeOption1", -1U)),
+ SomeOption(Options.get("SomeOption2", "some default")) {}
void storeOptions(ClangTidyOptions::OptionMap &Opts) {
- Options.store(Opts, "SomeOption", SomeOption);
+ Options.store(Opts, "SomeOption1", SomeOption1);
+ Options.store(Opts, "SomeOption2", SomeOption2);
}
...
+Assuming the check is registered with the name "my-check", the option can then
+be set in a ``.clang-tidy`` file in the following way:
+
+.. code-block:: yaml
+
+ CheckOptions: {
+ - key: my-check.SomeOption1
+ value: 123
+ - key: my-check.SomeOption2
+ value: 'some other value'
+ }
+
Running clang-tidy on LLVM
--------------------------
OpenPOWER on IntegriCloud