[clang-tidy] Make most ArgumentCommentCheck options local, as they should be

llvm-svn: 371076
This commit is contained in:
Alexander Kornienko 2019-09-05 14:48:31 +00:00
parent 42443e50ce
commit 30424e4268
3 changed files with 25 additions and 15 deletions

View File

@ -25,19 +25,14 @@ ArgumentCommentCheck::ArgumentCommentCheck(StringRef Name,
: ClangTidyCheck(Name, Context),
StrictMode(Options.getLocalOrGlobal("StrictMode", 0) != 0),
IgnoreSingleArgument(Options.get("IgnoreSingleArgument", 0) != 0),
CommentBoolLiterals(Options.getLocalOrGlobal("CommentBoolLiterals", 0) !=
0),
CommentIntegerLiterals(
Options.getLocalOrGlobal("CommentIntegerLiterals", 0) != 0),
CommentFloatLiterals(
Options.getLocalOrGlobal("CommentFloatLiterals", 0) != 0),
CommentStringLiterals(
Options.getLocalOrGlobal("CommentStringLiterals", 0) != 0),
CommentUserDefinedLiterals(
Options.getLocalOrGlobal("CommentUserDefinedLiterals", 0) != 0),
CommentCharacterLiterals(
Options.getLocalOrGlobal("CommentCharacterLiterals", 0) != 0),
CommentNullPtrs(Options.getLocalOrGlobal("CommentNullPtrs", 0) != 0),
CommentBoolLiterals(Options.get("CommentBoolLiterals", 0) != 0),
CommentIntegerLiterals(Options.get("CommentIntegerLiterals", 0) != 0),
CommentFloatLiterals(Options.get("CommentFloatLiterals", 0) != 0),
CommentStringLiterals(Options.get("CommentStringLiterals", 0) != 0),
CommentUserDefinedLiterals(Options.get("CommentUserDefinedLiterals", 0) !=
0),
CommentCharacterLiterals(Options.get("CommentCharacterLiterals", 0) != 0),
CommentNullPtrs(Options.get("CommentNullPtrs", 0) != 0),
IdentRE("^(/\\* *)([_A-Za-z][_A-Za-z0-9]*)( *= *\\*/)$") {}
void ArgumentCommentCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {

View File

@ -1,5 +1,13 @@
// RUN: %check_clang_tidy %s bugprone-argument-comment %t -- \
// RUN: -config="{CheckOptions: [{key: bugprone-argument-comment.IgnoreSingleArgument, value: 1}, {key: CommentBoolLiterals, value: 1},{key: CommentIntegerLiterals, value: 1}, {key: CommentFloatLiterals, value: 1}, {key: CommentUserDefinedLiterals, value: 1}, {key: CommentStringLiterals, value: 1}, {key: CommentNullPtrs, value: 1}, {key: CommentCharacterLiterals, value: 1}]}" --
// RUN: -config="{CheckOptions: [ \
// RUN: {key: bugprone-argument-comment.IgnoreSingleArgument, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentBoolLiterals, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentIntegerLiterals, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentFloatLiterals, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentUserDefinedLiterals, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentStringLiterals, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentNullPtrs, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentCharacterLiterals, value: 1}]}" --
struct A {
void foo(bool abc);

View File

@ -1,5 +1,12 @@
// RUN: %check_clang_tidy %s bugprone-argument-comment %t -- \
// RUN: -config="{CheckOptions: [{key: CommentBoolLiterals, value: 1},{key: CommentIntegerLiterals, value: 1}, {key: CommentFloatLiterals, value: 1}, {key: CommentUserDefinedLiterals, value: 1}, {key: CommentStringLiterals, value: 1}, {key: CommentNullPtrs, value: 1}, {key: CommentCharacterLiterals, value: 1}]}" --
// RUN: -config="{CheckOptions: [ \
// RUN: {key: bugprone-argument-comment.CommentBoolLiterals, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentIntegerLiterals, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentFloatLiterals, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentUserDefinedLiterals, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentStringLiterals, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentNullPtrs, value: 1}, \
// RUN: {key: bugprone-argument-comment.CommentCharacterLiterals, value: 1}]}" --
struct A {
void foo(bool abc);