[PATCH] [clang-tidy] Don't ignore default set of checks when a config file is found.
Alexander Kornienko
alexfh at google.com
Thu Feb 5 05:54:10 PST 2015
Hi djasper,
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.
http://reviews.llvm.org/D7434
Files:
clang-tidy/ClangTidyOptions.cpp
test/clang-tidy/config-files.cpp
Index: clang-tidy/ClangTidyOptions.cpp
===================================================================
--- clang-tidy/ClangTidyOptions.cpp
+++ clang-tidy/ClangTidyOptions.cpp
@@ -241,10 +241,9 @@
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;
}
Index: test/clang-tidy/config-files.cpp
===================================================================
--- test/clang-tidy/config-files.cpp
+++ test/clang-tidy/config-files.cpp
@@ -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
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7434.19403.patch
Type: text/x-patch
Size: 1864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150205/229ba387/attachment.bin>
More information about the cfe-commits
mailing list