From da550a42bbdac890d8af5a78da7e1d0a16e6ea79 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 17 Aug 2016 21:41:45 +0000 Subject: [PATCH] PR18417: Increase -ftemplate-depth to the value 1024 recommended by the C++ standard's Annex B. We now attempt to increase the process's stack rlimit to 8MiB on startup, which appears to be enough to allow this to work reliably. (And if it turns out not to be, we can investigate increasing it further.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278983 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/LangOptions.def | 2 +- lib/Frontend/CompilerInvocation.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def index 7a2bf24d3a..764e9bcb89 100644 --- a/include/clang/Basic/LangOptions.def +++ b/include/clang/Basic/LangOptions.def @@ -235,7 +235,7 @@ ENUM_LANGOPT(SignedOverflowBehavior, SignedOverflowBehaviorTy, 2, SOB_Undefined, BENIGN_LANGOPT(ArrowDepth, 32, 256, "maximum number of operator->s to follow") -BENIGN_LANGOPT(InstantiationDepth, 32, 256, +BENIGN_LANGOPT(InstantiationDepth, 32, 1024, "maximum template instantiation depth") BENIGN_LANGOPT(ConstexprCallDepth, 32, 512, "maximum constexpr call depth") diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index e19b612b6e..b1e985f077 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1910,7 +1910,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors); Opts.MathErrno = !Opts.OpenCL && Args.hasArg(OPT_fmath_errno); Opts.InstantiationDepth = - getLastArgIntValue(Args, OPT_ftemplate_depth, 256, Diags); + getLastArgIntValue(Args, OPT_ftemplate_depth, 1024, Diags); Opts.ArrowDepth = getLastArgIntValue(Args, OPT_foperator_arrow_depth, 256, Diags); Opts.ConstexprCallDepth = -- 2.50.1