[analyzer] Drop deprecated flags

As proposed in D126215 (ffe7950ebc),
I'm dropping the `-analyzer-store` and
`-analyzer-opt-analyze-nested-blocks` clang frontend flags.
I'm also dropping the corresponding commandline handlers of `scanbuild`.

This behavior is planned to be part of `clang-16`.

Reviewed By: xazax.hun

Differential Revision: https://reviews.llvm.org/D132289
This commit is contained in:
Balazs Benics 2022-08-23 18:39:21 +02:00
parent 16cb3be626
commit 6ca17b58f5
7 changed files with 12 additions and 46 deletions

View File

@ -233,6 +233,11 @@ libclang
Static Analyzer
---------------
- Removed the deprecated ``-analyzer-store`` and
``-analyzer-opt-analyze-nested-blocks`` analyzer flags.
``scanbuild`` was also updated accordingly.
Passing these flags will result in a hard error.
.. _release-notes-ubsan:
Undefined Behavior Sanitizer (UBSan)

View File

@ -5075,11 +5075,6 @@ def analysis_UnoptimizedCFG : Flag<["-"], "unoptimized-cfg">,
def analysis_CFGAddImplicitDtors : Flag<["-"], "cfg-add-implicit-dtors">,
HelpText<"Add C++ implicit destructors to CFGs for all analyses">;
// We should remove this option in clang-16 release.
def analyzer_store : Separate<["-"], "analyzer-store">,
HelpText<"Source Code Analysis - Abstract Memory Store Models [DEPRECATED, removing in clang-16]">;
def analyzer_store_EQ : Joined<["-"], "analyzer-store=">, Alias<analyzer_store>;
def analyzer_constraints : Separate<["-"], "analyzer-constraints">,
HelpText<"Source Code Analysis - Symbolic Constraint Engines">;
def analyzer_constraints_EQ : Joined<["-"], "analyzer-constraints=">,
@ -5097,9 +5092,6 @@ def analyzer_purge_EQ : Joined<["-"], "analyzer-purge=">, Alias<analyzer_purge>;
def analyzer_opt_analyze_headers : Flag<["-"], "analyzer-opt-analyze-headers">,
HelpText<"Force the static analyzer to analyze functions defined in header files">,
MarshallingInfoFlag<AnalyzerOpts<"AnalyzeAll">>;
// We should remove this option in clang-16 release.
def analyzer_opt_analyze_nested_blocks : Flag<["-"], "analyzer-opt-analyze-nested-blocks">,
HelpText<"Analyze the definitions of blocks in addition to functions [DEPRECATED, removing in clang-16]">;
def analyzer_display_progress : Flag<["-"], "analyzer-display-progress">,
HelpText<"Emit verbose output about the analyzer's progress">,
MarshallingInfoFlag<AnalyzerOpts<"AnalyzerDisplayProgress">>;

View File

@ -907,14 +907,6 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
#include "clang/Driver/Options.inc"
#undef ANALYZER_OPTION_WITH_MARSHALLING
if (Args.hasArg(OPT_analyzer_store))
Diags.Report(diag::warn_analyzer_deprecated_option) << "-analyzer-store"
<< "clang-16";
if (Args.hasArg(OPT_analyzer_opt_analyze_nested_blocks))
Diags.Report(diag::warn_analyzer_deprecated_option)
<< "-analyzer-opt-analyze-nested-blocks"
<< "clang-16";
if (Arg *A = Args.getLastArg(OPT_analyzer_constraints)) {
StringRef Name = A->getValue();
AnalysisConstraints Value = llvm::StringSwitch<AnalysisConstraints>(Name)

View File

@ -1,18 +1,13 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core %s 2>&1 \
// RUN: | FileCheck %s --check-prefixes=CHECK
// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-store=region %s 2>&1 \
// RUN: | FileCheck %s --check-prefixes=CHECK,DEPRECATED-STORE
// DEPRECATED-STORE: warning: analyzer option '-analyzer-store' is deprecated. This flag will be removed in clang-16, and passing this option will be an error.
// RUN: not %clang_analyze_cc1 -analyzer-checker=core -analyzer-store=region %s 2>&1 \
// RUN: | FileCheck %s --check-prefixes=DEPRECATED-STORE
// DEPRECATED-STORE: error: unknown argument: '-analyzer-store=region'
// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-opt-analyze-nested-blocks %s 2>&1 \
// RUN: | FileCheck %s --check-prefixes=CHECK,DEPRECATED-NESTED-BLOCKS
// DEPRECATED-NESTED-BLOCKS: warning: analyzer option '-analyzer-opt-analyze-nested-blocks' is deprecated. This flag will be removed in clang-16, and passing this option will be an error.
// RUN: %clang_analyze_cc1 -analyzer-checker=core %s --help 2>&1 \
// RUN: | FileCheck %s --check-prefixes=CHECK-HELP
// CHECK-HELP: Analyze the definitions of blocks in addition to functions [DEPRECATED, removing in clang-16]
// CHECK-HELP: -analyzer-store <value> Source Code Analysis - Abstract Memory Store Models [DEPRECATED, removing in clang-16]
// RUN: not %clang_analyze_cc1 -analyzer-checker=core -analyzer-opt-analyze-nested-blocks %s 2>&1 \
// RUN: | FileCheck %s --check-prefixes=DEPRECATED-NESTED-BLOCKS
// DEPRECATED-NESTED-BLOCKS: error: unknown argument: '-analyzer-opt-analyze-nested-blocks'
int empty(int x) {
// CHECK: warning: Division by zero

View File

@ -386,8 +386,6 @@ def analyzer_params(args):
result = []
if args.store_model:
result.append('-analyzer-store={0}'.format(args.store_model))
if args.constraints_model:
result.append('-analyzer-constraints={0}'.format(
args.constraints_model))

View File

@ -61,7 +61,6 @@ my %Options = (
UseCC => undef, # C compiler to use for compilation.
UseCXX => undef, # C++ compiler to use for compilation.
AnalyzerTarget => undef,
StoreModel => undef,
ConstraintsModel => undef,
InternalStats => undef,
OutputFormat => "html",
@ -977,8 +976,7 @@ sub SetEnv {
die "$var is undefined\n" if (!defined $var);
$ENV{$var} = $EnvVars->{$var};
}
foreach my $var ('CCC_ANALYZER_STORE_MODEL',
'CCC_ANALYZER_CONSTRAINTS_MODEL',
foreach my $var ('CCC_ANALYZER_CONSTRAINTS_MODEL',
'CCC_ANALYZER_INTERNAL_STATS',
'CCC_ANALYZER_OUTPUT_FORMAT',
'CCC_CC',
@ -1704,12 +1702,6 @@ sub ProcessArgs {
next;
}
if ($arg eq "-store") {
shift @$Args;
$Options{StoreModel} = shift @$Args;
next;
}
if ($arg eq "-constraints") {
shift @$Args;
$Options{ConstraintsModel} = shift @$Args;
@ -1958,7 +1950,6 @@ my %EnvVars = (
'CCC_CC' => $Options{UseCC},
'CCC_CXX' => $Options{UseCXX},
'CCC_REPORT_FAILURES' => $Options{ReportFailures},
'CCC_ANALYZER_STORE_MODEL' => $Options{StoreModel},
'CCC_ANALYZER_CONSTRAINTS_MODEL' => $Options{ConstraintsModel},
'CCC_ANALYZER_INTERNAL_STATS' => $Options{InternalStats},
'CCC_ANALYZER_OUTPUT_FORMAT' => $Options{OutputFormat},

View File

@ -466,9 +466,6 @@ my $Analyses = $ENV{'CCC_ANALYZER_ANALYSIS'};
# Get the plugins to load.
my $Plugins = $ENV{'CCC_ANALYZER_PLUGINS'};
# Get the store model.
my $StoreModel = $ENV{'CCC_ANALYZER_STORE_MODEL'};
# Get the constraints engine.
my $ConstraintsModel = $ENV{'CCC_ANALYZER_CONSTRAINTS_MODEL'};
@ -729,10 +726,6 @@ if ($Action eq 'compile' or $Action eq 'link') {
push @CmdArgs, '-x', $FileLang;
}
if (defined $StoreModel) {
push @AnalyzeArgs, "-analyzer-store=$StoreModel";
}
if (defined $ConstraintsModel) {
push @AnalyzeArgs, "-analyzer-constraints=$ConstraintsModel";
}