[clang-tidy] Don't ignore default set of checks when a config file is found.
Summary: This makes clang-tidy merge the default set of checks with the one provided in the configuration file instead of just using the checks from the config file. This adds a way to modify the default set of checks while the previous behavior required to always define the set of checks completely. Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D7434 llvm-svn: 228298
This commit is contained in:
parent
15774dfc21
commit
b6e1fde719
|
@ -241,10 +241,9 @@ FileOptionsProvider::TryReadConfigFile(StringRef Directory) {
|
|||
continue;
|
||||
}
|
||||
|
||||
ClangTidyOptions Defaults = DefaultOptionsProvider::getOptions(Directory);
|
||||
// Only use checks from the config file.
|
||||
Defaults.Checks = None;
|
||||
return Defaults.mergeWith(*ParsedOptions).mergeWith(OverrideOptions);
|
||||
return DefaultOptionsProvider::getOptions(Directory)
|
||||
.mergeWith(*ParsedOptions)
|
||||
.mergeWith(OverrideOptions);
|
||||
}
|
||||
return llvm::None;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// RUN: clang-tidy -dump-config %S/Inputs/config-files/- -- | FileCheck %s -check-prefix=CHECK-BASE
|
||||
// CHECK-BASE: Checks: from-parent
|
||||
// CHECK-BASE: Checks: {{.*}}from-parent
|
||||
// CHECK-BASE: HeaderFilterRegex: parent
|
||||
// RUN: clang-tidy -dump-config %S/Inputs/config-files/1/- -- | FileCheck %s -check-prefix=CHECK-CHILD1
|
||||
// CHECK-CHILD1: Checks: from-child1
|
||||
// CHECK-CHILD1: Checks: {{.*}}from-child1
|
||||
// CHECK-CHILD1: HeaderFilterRegex: child1
|
||||
// RUN: clang-tidy -dump-config %S/Inputs/config-files/2/- -- | FileCheck %s -check-prefix=CHECK-CHILD2
|
||||
// CHECK-CHILD2: Checks: from-parent
|
||||
// CHECK-CHILD2: Checks: {{.*}}from-parent
|
||||
// CHECK-CHILD2: HeaderFilterRegex: parent
|
||||
// RUN: clang-tidy -dump-config -checks='from-command-line' -header-filter='from command line' %S/Inputs/config-files/- -- | FileCheck %s -check-prefix=CHECK-COMMAND-LINE
|
||||
// CHECK-COMMAND-LINE: Checks: from-parent,from-command-line
|
||||
// CHECK-COMMAND-LINE: Checks: {{.*}}from-parent,from-command-line
|
||||
// CHECK-COMMAND-LINE: HeaderFilterRegex: from command line
|
||||
|
|
Loading…
Reference in New Issue