Sema: Type checking for C function pointers.

Since a function pointer doesn't carry any context, we can only form a C function pointer from a static reference to a global function or a context-free local function or closure. (Or maybe a static function applied to its metatype, but that's not handled here yet.) As a placeholder for a to-be-bikeshedded surface syntax, let the existing @cc(cdecl) attribute appear in source text when the -enable-c-function-pointers frontend flag is passed.

Swift SVN r25308
This commit is contained in:
Joe Groff
2015-02-16 00:41:53 +00:00
parent 33c9457930
commit 94be8424ff
10 changed files with 193 additions and 4 deletions

View File

@@ -560,6 +560,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.EnableExperimentalUnavailableAsOptional |=
Args.hasArg(OPT_enable_experimental_unavailable_as_optional);
Opts.EnableCFunctionPointers |=
Args.hasArg(OPT_enable_c_function_pointers);
Opts.EnableCharacterLiterals |= Args.hasArg(OPT_enable_character_literals);
Opts.UsePrivateDiscriminators |=
Args.hasArg(OPT_enable_private_discriminators);