[clang] [clang] Increase the default expression nesting limit (PR #104717)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 18 11:16:18 PDT 2024


https://github.com/AmrDeveloper created https://github.com/llvm/llvm-project/pull/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

>From ba301df0e8fc84243a994ddcd36becb16f34b32c Mon Sep 17 00:00:00 2001
From: AmrDeveloper <amr96 at programmer.net>
Date: Sun, 18 Aug 2024 20:05:38 +0200
Subject: [PATCH] [clang] Increase the default expression nesting limit

Increase the default expression nesting limit from 256 to 1024
---
 clang/include/clang/Driver/Options.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index cfd9e595c55178..3a0054fdafc638 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">, "1024">;
 defm const_strings : BoolOption<"f", "const-strings",
   LangOpts<"ConstStrings">, DefaultFalse,
   PosFlag<SetTrue, [], [ClangOption, CC1Option], "Use">,



More information about the cfe-commits mailing list