mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 20:51:35 +00:00
[clang-tidy] Updated documentation
Added an example of check-specific options. llvm-svn: 218573
This commit is contained in:
parent
9d32634c61
commit
04e9d9ce64
@ -374,18 +374,33 @@ the check implements and what the current values are (e.g. for the
|
|||||||
.. code-block:: c++
|
.. code-block:: c++
|
||||||
|
|
||||||
class MyCheck : public ClangTidyCheck {
|
class MyCheck : public ClangTidyCheck {
|
||||||
const unsigned SomeOption;
|
const unsigned SomeOption1;
|
||||||
|
const std::string SomeOption2;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyCheck(StringRef Name, ClangTidyContext *Context)
|
MyCheck(StringRef Name, ClangTidyContext *Context)
|
||||||
: ClangTidyCheck(Name, 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) {
|
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
|
Running clang-tidy on LLVM
|
||||||
--------------------------
|
--------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user