[clang-tidy] Remove AnalyzeTemporaryDtors option.

Remove the `AnalyzeTemporaryDtors` option, since the corresponding
`cfg-temporary-dtors` option of the Static Analyzer defaults to `true` since
r326461.

llvm-svn: 331456
This commit is contained in:
Alexander Kornienko 2018-05-03 14:40:37 +00:00
parent 0133a11977
commit 8d4bc72788
8 changed files with 6 additions and 38 deletions

View File

@ -369,11 +369,6 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
Consumers.push_back(Finder->newASTConsumer());
AnalyzerOptionsRef AnalyzerOptions = Compiler.getAnalyzerOpts();
// FIXME: Remove this option once clang's cfg-temporary-dtors option defaults
// to true.
AnalyzerOptions->Config["cfg-temporary-dtors"] =
Context.getOptions().AnalyzeTemporaryDtors ? "true" : "false";
AnalyzerOptions->CheckersControlList = getCheckersControlList(Context);
if (!AnalyzerOptions->CheckersControlList.empty()) {
setStaticAnalyzerCheckerOpts(Context.getOptions(), AnalyzerOptions);

View File

@ -86,7 +86,6 @@ template <> struct MappingTraits<ClangTidyOptions> {
IO.mapOptional("Checks", Options.Checks);
IO.mapOptional("WarningsAsErrors", Options.WarningsAsErrors);
IO.mapOptional("HeaderFilterRegex", Options.HeaderFilterRegex);
IO.mapOptional("AnalyzeTemporaryDtors", Options.AnalyzeTemporaryDtors);
IO.mapOptional("FormatStyle", Options.FormatStyle);
IO.mapOptional("User", Options.User);
IO.mapOptional("CheckOptions", NOpts->Options);
@ -107,7 +106,6 @@ ClangTidyOptions ClangTidyOptions::getDefaults() {
Options.WarningsAsErrors = "";
Options.HeaderFilterRegex = "";
Options.SystemHeaders = false;
Options.AnalyzeTemporaryDtors = false;
Options.FormatStyle = "none";
Options.User = llvm::None;
for (ClangTidyModuleRegistry::iterator I = ClangTidyModuleRegistry::begin(),
@ -147,7 +145,6 @@ ClangTidyOptions::mergeWith(const ClangTidyOptions &Other) const {
mergeCommaSeparatedLists(Result.WarningsAsErrors, Other.WarningsAsErrors);
overrideValue(Result.HeaderFilterRegex, Other.HeaderFilterRegex);
overrideValue(Result.SystemHeaders, Other.SystemHeaders);
overrideValue(Result.AnalyzeTemporaryDtors, Other.AnalyzeTemporaryDtors);
overrideValue(Result.FormatStyle, Other.FormatStyle);
overrideValue(Result.User, Other.User);
mergeVectors(Result.ExtraArgs, Other.ExtraArgs);

View File

@ -74,9 +74,6 @@ struct ClangTidyOptions {
/// \brief Output warnings from system headers matching \c HeaderFilterRegex.
llvm::Optional<bool> SystemHeaders;
/// \brief Turns on temporary destructor-based analysis.
llvm::Optional<bool> AnalyzeTemporaryDtors;
/// \brief Format code around applied fixes with clang-format using this
/// style.
///

View File

@ -41,7 +41,6 @@ Configuration files:
Checks: '-*,some-check'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
User: user
CheckOptions:
@ -182,16 +181,6 @@ report to stderr.
cl::init(false),
cl::cat(ClangTidyCategory));
static cl::opt<bool> AnalyzeTemporaryDtors("analyze-temporary-dtors",
cl::desc(R"(
Enable temporary destructor-aware analysis in
clang-analyzer- checks.
This option overrides the value read from a
.clang-tidy file.
)"),
cl::init(false),
cl::cat(ClangTidyCategory));
static cl::opt<std::string> ExportFixes("export-fixes", cl::desc(R"(
YAML file to store suggested fixes in. The
stored fixes can be applied to the input source
@ -300,7 +289,6 @@ static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider(
DefaultOptions.WarningsAsErrors = "";
DefaultOptions.HeaderFilterRegex = HeaderFilter;
DefaultOptions.SystemHeaders = SystemHeaders;
DefaultOptions.AnalyzeTemporaryDtors = AnalyzeTemporaryDtors;
DefaultOptions.FormatStyle = FormatStyle;
DefaultOptions.User = llvm::sys::Process::GetEnv("USER");
// USERNAME is used on Windows.
@ -316,8 +304,6 @@ static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider(
OverrideOptions.HeaderFilterRegex = HeaderFilter;
if (SystemHeaders.getNumOccurrences() > 0)
OverrideOptions.SystemHeaders = SystemHeaders;
if (AnalyzeTemporaryDtors.getNumOccurrences() > 0)
OverrideOptions.AnalyzeTemporaryDtors = AnalyzeTemporaryDtors;
if (FormatStyle.getNumOccurrences() > 0)
OverrideOptions.FormatStyle = FormatStyle;

View File

@ -162,6 +162,9 @@ Improvements to clang-tidy
Flags functions that have more than a specified number of variables declared
in the body.
- The `AnalyzeTemporaryDtors` option was removed, since the corresponding
`cfg-temporary-dtors` option of the Static Analyzer now defaults to `true`.
- New alias :doc:`hicpp-avoid-goto
<clang-tidy/checks/hicpp-avoid-goto>` to :doc:`cppcoreguidelines-avoid-goto
<clang-tidy/checks/cppcoreguidelines-avoid-goto>`

View File

@ -112,11 +112,6 @@ An overview of all the command-line options:
clang-tidy options:
-analyze-temporary-dtors -
Enable temporary destructor-aware analysis in
clang-analyzer- checks.
This option overrides the value read from a
.clang-tidy file.
-checks=<string> -
Comma-separated list of globs with optional '-'
prefix. Globs are processed in order of
@ -245,7 +240,6 @@ An overview of all the command-line options:
Checks: '-*,some-check'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
User: user
CheckOptions:

View File

@ -1,4 +1,4 @@
// RUN: clang-tidy -checks='-*,clang-analyzer-core.NullDereference' -analyze-temporary-dtors %s -- | FileCheck %s
// RUN: clang-tidy -checks='-*,clang-analyzer-core.NullDereference' %s -- | FileCheck %s
struct NoReturnDtor {
~NoReturnDtor() __attribute__((noreturn));
@ -17,7 +17,8 @@ void testNullPointerDereferencePositive() {
void testNullPointerDereference() {
int *value = 0;
if (check(NoReturnDtor())) {
// This unreachable code causes a warning if we don't run with -analyze-temporary-dtors
// This unreachable code causes a warning if analysis of temporary
// destructors is not enabled.
*value = 1;
}
}

View File

@ -58,12 +58,10 @@ TEST(ParseConfiguration, ValidConfiguration) {
llvm::ErrorOr<ClangTidyOptions> Options =
parseConfiguration("Checks: \"-*,misc-*\"\n"
"HeaderFilterRegex: \".*\"\n"
"AnalyzeTemporaryDtors: true\n"
"User: some.user");
EXPECT_TRUE(!!Options);
EXPECT_EQ("-*,misc-*", *Options->Checks);
EXPECT_EQ(".*", *Options->HeaderFilterRegex);
EXPECT_TRUE(*Options->AnalyzeTemporaryDtors);
EXPECT_EQ("some.user", *Options->User);
}
@ -71,7 +69,6 @@ TEST(ParseConfiguration, MergeConfigurations) {
llvm::ErrorOr<ClangTidyOptions> Options1 = parseConfiguration(R"(
Checks: "check1,check2"
HeaderFilterRegex: "filter1"
AnalyzeTemporaryDtors: true
User: user1
ExtraArgs: ['arg1', 'arg2']
ExtraArgsBefore: ['arg-before1', 'arg-before2']
@ -80,7 +77,6 @@ TEST(ParseConfiguration, MergeConfigurations) {
llvm::ErrorOr<ClangTidyOptions> Options2 = parseConfiguration(R"(
Checks: "check3,check4"
HeaderFilterRegex: "filter2"
AnalyzeTemporaryDtors: false
User: user2
ExtraArgs: ['arg3', 'arg4']
ExtraArgsBefore: ['arg-before3', 'arg-before4']
@ -89,7 +85,6 @@ TEST(ParseConfiguration, MergeConfigurations) {
ClangTidyOptions Options = Options1->mergeWith(*Options2);
EXPECT_EQ("check1,check2,check3,check4", *Options.Checks);
EXPECT_EQ("filter2", *Options.HeaderFilterRegex);
EXPECT_FALSE(*Options.AnalyzeTemporaryDtors);
EXPECT_EQ("user2", *Options.User);
ASSERT_TRUE(Options.ExtraArgs.hasValue());
EXPECT_EQ("arg1,arg2,arg3,arg4", llvm::join(Options.ExtraArgs->begin(),