diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-04-24 17:56:46 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-04-24 17:56:46 +0000 |
commit | fca18c1b41f590686a275e0f0a1ee652510296a2 (patch) | |
tree | 1740bb7b098856f4150828033110b33a5025d091 /clang/lib/CodeGen/CGObjCMac.cpp | |
parent | db059592fe0aeb6580bbad33203dff7cdb4c010c (diff) | |
download | bcm5719-llvm-fca18c1b41f590686a275e0f0a1ee652510296a2.tar.gz bcm5719-llvm-fca18c1b41f590686a275e0f0a1ee652510296a2.zip |
NeXT: Clean up dispatch method policy selection.
- Replace -cc1 level -fobjc-legacy-dispatch with -fobjc-dispatch-method={legacy,non-legacy,mixed}.
- Lift "mixed" vs "non-mixed" policy choice up to driver level, instead of being buried in CGObjCMac.cpp.
- No intended functionality change.
llvm-svn: 102255
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index e000bd22aaa..098a0f8221f 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -4275,13 +4275,19 @@ void CGObjCNonFragileABIMac::FinishNonFragileABIModule() { /// message dispatch call for all the rest. /// bool CGObjCNonFragileABIMac::LegacyDispatchedSelector(Selector Sel) { - if (CGM.getCodeGenOpts().ObjCLegacyDispatch) + switch (CGM.getCodeGenOpts().getObjCDispatchMethod()) { + default: + assert(0 && "Invalid dispatch method!"); + case CodeGenOptions::Legacy: return true; - /* Leopard */ - if (CGM.getContext().Target.getTriple().getOS() == llvm::Triple::Darwin && - CGM.getContext().Target.getTriple().getDarwinMajorNumber() <= 9) + case CodeGenOptions::NonLegacy: return false; - + case CodeGenOptions::Mixed: + break; + } + + // If so, see whether this selector is in the white-list of things which must + // use the new dispatch convention. We lazily build a dense set for this. if (NonLegacyDispatchMethods.empty()) { NonLegacyDispatchMethods.insert(GetNullarySelector("alloc")); NonLegacyDispatchMethods.insert(GetNullarySelector("class")); @@ -4311,6 +4317,7 @@ bool CGObjCNonFragileABIMac::LegacyDispatchedSelector(Selector Sel) { NonLegacyDispatchMethods.insert( CGM.getContext().Selectors.getSelector(3, KeyIdents)); } + return (NonLegacyDispatchMethods.count(Sel) == 0); } |