[Sema] Flag -disable-infer-iuos: don't infer IUO type for untyped bindings

If this option is enabled, when generating potential bindings for a type
variable, don't propagate IUO type. Instead try the optional type and
the underlying type. This way, untyped bindings will not be given IUO
type when they are initialized with exprs of IUO type.
This commit is contained in:
Chris Willmore
2016-03-21 17:15:23 -07:00
parent 3dd149ab99
commit 4cc75187c6
5 changed files with 37 additions and 0 deletions

View File

@@ -764,6 +764,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.WarnOmitNeedlessWords = Args.hasArg(OPT_warn_omit_needless_words);
Opts.OmitNeedlessWords |= Args.hasArg(OPT_enable_omit_needless_words);
Opts.StripNSPrefix = Args.hasArg(OPT_enable_strip_ns_prefix);
if (Args.hasArg(OPT_disable_infer_iuos)) {
Opts.InferIUOs = false;
}
Opts.EnableThrowWithoutTry |= Args.hasArg(OPT_enable_throw_without_try);