[clang-tools-extra] r228298 - [clang-tidy] Don't ignore default set of checks when a config file is found.
Alexander Kornienko
alexfh at google.com
Thu Feb 5 06:50:17 PST 2015
Author: alexfh
Date: Thu Feb 5 08:50:17 2015
New Revision: 228298
URL: http://llvm.org/viewvc/llvm-project?rev=228298&view=rev
Log:
[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
Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp
clang-tools-extra/trunk/test/clang-tidy/config-files.cpp
Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp?rev=228298&r1=228297&r2=228298&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp Thu Feb 5 08:50:17 2015
@@ -241,10 +241,9 @@ FileOptionsProvider::TryReadConfigFile(S
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;
}
Modified: clang-tools-extra/trunk/test/clang-tidy/config-files.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/config-files.cpp?rev=228298&r1=228297&r2=228298&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/config-files.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/config-files.cpp Thu Feb 5 08:50:17 2015
@@ -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
More information about the cfe-commits
mailing list