diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-21 19:36:32 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-21 19:36:32 +0000 |
commit | c18c42345636e2866fed75c7e434fb659d747672 (patch) | |
tree | 31a128be6a47b71082d8ca0dea883dd19a4b77be /lib/Frontend/CompilerInvocation.cpp | |
parent | 1052c1dc52447643dac5484d3a22ab836c781f47 (diff) |
Add driver arguments -ftemplate-depth=N and -fconstexpr-depth=N, with the same
semantics and defaults as the corresponding g++ arguments. The historical g++
argument -ftemplate-depth-N is kept for compatibility, but modern g++ versions
no longer document that option.
Add -cc1 argument -fconstexpr-depth N to implement the corresponding
functionality.
The -ftemplate-depth=N part of this fixes PR9890.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 738facf069..34080908c0 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -789,6 +789,10 @@ static void LangOptsToArgs(const LangOptions &Opts, Res.push_back("-ftemplate-depth"); Res.push_back(llvm::utostr(Opts.InstantiationDepth)); } + if (Opts.ConstexprCallDepth != DefaultLangOpts.ConstexprCallDepth) { + Res.push_back("-fconstexpr-depth"); + Res.push_back(llvm::utostr(Opts.ConstexprCallDepth)); + } if (!Opts.ObjCConstantStringClass.empty()) { Res.push_back("-fconstant-string-class"); Res.push_back(Opts.ObjCConstantStringClass); @@ -1777,7 +1781,9 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors); Opts.MathErrno = Args.hasArg(OPT_fmath_errno); Opts.InstantiationDepth = Args.getLastArgIntValue(OPT_ftemplate_depth, 1024, - Diags); + Diags); + Opts.ConstexprCallDepth = Args.getLastArgIntValue(OPT_fconstexpr_depth, 512, + Diags); Opts.DelayedTemplateParsing = Args.hasArg(OPT_fdelayed_template_parsing); Opts.NumLargeByValueCopy = Args.getLastArgIntValue(OPT_Wlarge_by_value_copy, 0, Diags); |