[clang] 6ca17b5 - [analyzer] Drop deprecated flags
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 23 09:40:08 PDT 2022
Author: Balazs Benics
Date: 2022-08-23T18:39:21+02:00
New Revision: 6ca17b58f569d43838404f5c94856e3584a23d0f
URL: https://github.com/llvm/llvm-project/commit/6ca17b58f569d43838404f5c94856e3584a23d0f
DIFF: https://github.com/llvm/llvm-project/commit/6ca17b58f569d43838404f5c94856e3584a23d0f.diff
LOG: [analyzer] Drop deprecated flags
As proposed in D126215 (ffe7950ebc62380c3afc7c71f454a1db3f6f5c76),
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
Added:
Modified:
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Analysis/deprecated-flags-and-options.cpp
clang/tools/scan-build-py/lib/libscanbuild/analyze.py
clang/tools/scan-build/bin/scan-build
clang/tools/scan-build/libexec/ccc-analyzer
Removed:
################################################################################
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index ee9c463bb3468..0ba35edd5dcb7 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -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)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index ec5f553f64584..0666768c7e74b 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -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">>;
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 7e6d0cd7f504a..6b5baa75fd27a 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -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)
diff --git a/clang/test/Analysis/deprecated-flags-and-options.cpp b/clang/test/Analysis/deprecated-flags-and-options.cpp
index 262ce9dfd96fa..23272c1b96688 100644
--- a/clang/test/Analysis/deprecated-flags-and-options.cpp
+++ b/clang/test/Analysis/deprecated-flags-and-options.cpp
@@ -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
diff --git a/clang/tools/scan-build-py/lib/libscanbuild/analyze.py b/clang/tools/scan-build-py/lib/libscanbuild/analyze.py
index 2633139fd523e..ebd6df1dc7579 100644
--- a/clang/tools/scan-build-py/lib/libscanbuild/analyze.py
+++ b/clang/tools/scan-build-py/lib/libscanbuild/analyze.py
@@ -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))
diff --git a/clang/tools/scan-build/bin/scan-build b/clang/tools/scan-build/bin/scan-build
index 71e7ced087199..8cd525f054fdc 100755
--- a/clang/tools/scan-build/bin/scan-build
+++ b/clang/tools/scan-build/bin/scan-build
@@ -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},
diff --git a/clang/tools/scan-build/libexec/ccc-analyzer b/clang/tools/scan-build/libexec/ccc-analyzer
index 35b7a27126c58..0c900293956f6 100755
--- a/clang/tools/scan-build/libexec/ccc-analyzer
+++ b/clang/tools/scan-build/libexec/ccc-analyzer
@@ -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";
}
More information about the cfe-commits
mailing list