mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Introduce an option to omit needless words when importing from Clang.
The -enable-omit-needless-words option attempts to omit needless words from method names imported from Clang. Broadly speaking, a word is needless if it merely restates the type of the corresponding parameter, using reverse camel-case matching of the type name to the function/parameter name. The word "With" is also considered needless if whether follows it is needless, e.g., func copyWithZone(zone: NSZone) gets reduced to func copy(zone: NSZone) because "Zone" merely restates type information and the remaining, trailing "With" is also needless. There are some special type naming rules for builtin Objective-C types, e.g., id -> "Object" SEL -> "Selector" Block pointer types -> "Block" as well as some very-Cocoa-specific matching rules, e.g., the type "IndexSet" matches the name "Indexes" or "Indices". Expect a lot of churn with these heuristics; this is part of rdar://problem/22232287. Swift SVN r31178
This commit is contained in:
@@ -782,6 +782,8 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts,
|
||||
Opts.InferImplicitProperties |=
|
||||
Args.hasArg(OPT_enable_objc_implicit_properties);
|
||||
|
||||
Opts.OmitNeedlessWords |= Args.hasArg(OPT_enable_omit_needless_words);
|
||||
|
||||
Opts.DumpClangDiagnostics |= Args.hasArg(OPT_dump_clang_diagnostics);
|
||||
|
||||
if (Args.hasArg(OPT_embed_bitcode))
|
||||
|
||||
Reference in New Issue
Block a user