[clang-tidy] Added support for validating configuration options
authorNathan James <n.james93@hotmail.co.uk>
Tue, 7 Apr 2020 18:53:52 +0000 (19:53 +0100)
committerNathan James <n.james93@hotmail.co.uk>
Tue, 7 Apr 2020 18:54:34 +0000 (19:54 +0100)
commitfcf7cc268fe4560bc7cd751494beceff45f5dd10
treec04d2f283b27ae03c3415e71210e717305a2f73a
parentaed2fdb1671c31ceff6997af56ae67831dad2595
[clang-tidy] Added support for validating configuration options

Summary:
Adds support for `ClangTidyCheck::OptionsView` to deteremine:
  - If an option is found in the configuration.
  - If an integer option read from configuration is parsable to an integer.
  - Parse and Serialize enum configuration options directly using a mapping from `llvm::StringRef` to `EnumType`.
  - If an integer or enum option isn't parseable but there is a default value it will issue a warning to stderr that the config value hasn't been used.
  - If an enum option isn't parsable it can provide a hint if the value was a typo.

Reviewers: aaron.ballman, alexfh, gribozavr2

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang, #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D77085
clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
clang-tools-extra/clang-tidy/ClangTidyCheck.h
clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp