aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-02-22 01:59:51 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-02-22 01:59:51 +0000
commit9e738cc9d4b4655c44dadeb22f3a314daf43b995 (patch)
tree0bf50b2a66275da24dd3406e62b032e5a9ea815f /include/clang/Basic
parent5e5440ba9c135f523f72e7e7c5da59d390d697c5 (diff)
Add -fbracket-depth=N, analogous to -ftemplate-depth= and -fconstexpr-depth=,
to control the check for the C 5.2.4.1 / C++ [implimits] restriction on nesting levels for parentheses, brackets and braces. Some code with heavy macro use exceeds the default limit of 256, but we don't want to increase it generally to avoid stack overflow on stack-constrained systems. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175855 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic')
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td6
-rw-r--r--include/clang/Basic/LangOptions.def2
2 files changed, 6 insertions, 2 deletions
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index c75241e623..6035937be6 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -465,8 +465,10 @@ def err_destructor_template_id : Error<
"destructor name %0 does not refer to a template">;
def err_default_arg_unparsed : Error<
"unexpected end of default argument expression">;
-def err_parser_impl_limit_overflow : Error<
- "parser recursion limit reached, program too complex">, DefaultFatal;
+def err_bracket_depth_exceeded : Error<
+ "bracket nesting level exceeded maximum of %0">, DefaultFatal;
+def note_bracket_depth : Note<
+ "use -fbracket-depth=N to increase maximum nesting level">;
def err_misplaced_ellipsis_in_declaration : Error<
"'...' must %select{immediately precede declared identifier|"
"be innermost component of anonymous pack declaration}0">;
diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def
index a7c753ed24..3de0107dff 100644
--- a/include/clang/Basic/LangOptions.def
+++ b/include/clang/Basic/LangOptions.def
@@ -160,6 +160,8 @@ BENIGN_LANGOPT(InstantiationDepth, 32, 512,
"maximum template instantiation depth")
BENIGN_LANGOPT(ConstexprCallDepth, 32, 512,
"maximum constexpr call depth")
+BENIGN_LANGOPT(BracketDepth, 32, 256,
+ "maximum bracket nesting depth")
BENIGN_LANGOPT(NumLargeByValueCopy, 32, 0,
"if non-zero, warn about parameter or return Warn if parameter/return value is larger in bytes than this setting. 0 is no check.")
VALUE_LANGOPT(MSCVersion, 32, 0,