diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index ee9c463bb34684..0ba35edd5dcb76 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 ec5f553f645846..0666768c7e74bd 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; - 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; def analyzer_opt_analyze_headers : Flag<["-"], "analyzer-opt-analyze-headers">, HelpText<"Force the static analyzer to analyze functions defined in header files">, MarshallingInfoFlag>; -// 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>; diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 7e6d0cd7f504a3..6b5baa75fd27aa 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(Name) diff --git a/clang/test/Analysis/deprecated-flags-and-options.cpp b/clang/test/Analysis/deprecated-flags-and-options.cpp index 262ce9dfd96fa0..23272c1b96688b 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 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 2633139fd523e3..ebd6df1dc7579b 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 71e7ced0871994..8cd525f054fdc2 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 35b7a27126c587..0c900293956f6b 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"; }