Author: Amr Hesham Date: 2024-08-19T15:07:25-04:00 New Revision: 7597e0930638e0a20ca9bfc193a3d89575ce4469
URL: https://github.com/llvm/llvm-project/commit/7597e0930638e0a20ca9bfc193a3d89575ce4469 DIFF: https://github.com/llvm/llvm-project/commit/7597e0930638e0a20ca9bfc193a3d89575ce4469.diff LOG: [clang] Increase the default expression nesting limit (#104717) Increase the default expression nesting limit from 256 to 1024 Fixes: #94728 Compile time with different Bracket depth Clang version 20.0.0git (https://github.com/AmrDeveloper/llvm-project.git 673b9e08de8a661c9deed2ee497889312f059f3d) Target: arm64-apple-darwin23.5.0 Bracket depth = 256, time = 0.243 Bracket depth = 512, time = 0.329 Bracket depth = 1024, time = 0.489 Bracket depth = 2048, time = 0.851 Added: Modified: clang/docs/ReleaseNotes.rst clang/include/clang/Driver/Options.td clang/test/Parser/parser_overflow.c Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 017df3cae468a1..249249971dec7c 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -174,6 +174,8 @@ Deprecated Compiler Flags Modified Compiler Flags ----------------------- +- The compiler flag `-fbracket-depth` default value is increased from 256 to 2048. + Removed Compiler Flags ------------------------- diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index cfd9e595c55178..c66e035a259b3f 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -7959,7 +7959,7 @@ def fapply_global_visibility_to_externs : Flag<["-"], "fapply-global-visibility- MarshallingInfoFlag<LangOpts<"SetVisibilityForExternDecls">>; def fbracket_depth : Separate<["-"], "fbracket-depth">, HelpText<"Maximum nesting level for parentheses, brackets, and braces">, - MarshallingInfoInt<LangOpts<"BracketDepth">, "256">; + MarshallingInfoInt<LangOpts<"BracketDepth">, "2048">; defm const_strings : BoolOption<"f", "const-strings", LangOpts<"ConstStrings">, DefaultFalse, PosFlag<SetTrue, [], [ClangOption, CC1Option], "Use">, diff --git a/clang/test/Parser/parser_overflow.c b/clang/test/Parser/parser_overflow.c index 9514e808550a4b..53c79bc06d993d 100644 --- a/clang/test/Parser/parser_overflow.c +++ b/clang/test/Parser/parser_overflow.c @@ -1,5 +1,5 @@ // RUN: not %clang_cc1 %s -fsyntax-only -DHUGE 2>&1 | FileCheck %s -// RUN: not %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang_cc1 %s -fsyntax-only // RUN: not %clang_cc1 %s -fsyntax-only -fbracket-depth 299 2>&1 | FileCheck %s // RUN: %clang_cc1 %s -fsyntax-only -fbracket-depth 300 // RUN: not %clang %s -fsyntax-only -fbracket-depth=299 2>&1 | FileCheck %s @@ -15,5 +15,5 @@ void foo(void) { #endif } -// CHECK: fatal error: bracket nesting level exceeded maximum of {{256|299}} +// CHECK: fatal error: bracket nesting level exceeded maximum of {{2048|299}} // CHECK: note: use -fbracket-depth=N to increase maximum nesting level _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits