require clang-tidy check argument

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

require clang-tidy check argument

Fangrui Song via cfe-dev
Hi,

Is there a way/pattern for a clang-tidy check to require an argument (ie an entry in the .clang-tidy file)?

Looking at the API It has a way for me to storeOptions, but Options.store will always have a Default value.

Tiago

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: require clang-tidy check argument

Fangrui Song via cfe-dev
Hi Tiago,

That support was adding in https://reviews.llvm.org/rGfcf7cc268fe4560bc7cd751494beceff45f5dd10. You can call `Options.get("Name")` or `Options.get<Inttype>("Name")` and it will return `llvm::Expected<...>`.
If there is no option found in the config it will return a `MissingOptionError`, If there is an option but it couldnt't be parsed to the Type it will return a `UnparseableIntegerOptionError`. you can just log the Error straight to `llvm::errs()`.

Regards,

Nathan James


On Thu, 2020-04-09 at 12:12 -0700, Tiago Macarios via cfe-dev wrote:
Hi,

Is there a way/pattern for a clang-tidy check to require an argument (ie an entry in the .clang-tidy file)?

Looking at the API It has a way for me to storeOptions, but Options.store will always have a Default value.

Tiago
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev