Commit 262316ad authored by Pawel Wodnicki's avatar Pawel Wodnicki
Browse files

Merging r167935: into the 3.2 release branch.

The ObjC++-to-C++ personality trick is only necessary on NeXT runtimes,
which is not coincidentally the only place it works, either (because
of how it tests for EH_TYPE symbols).

llvm-svn: 168611
parent 047c3baf
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -307,14 +307,15 @@ static bool PersonalityHasOnlyCXXUses(llvm::Constant *Fn) {
/// aggressive about only using the ObjC++ personality in a function
/// when it really needs it.
void CodeGenModule::SimplifyPersonality() {
  // For now, this is really a Darwin-specific operation.
  if (!Context.getTargetInfo().getTriple().isOSDarwin())
    return;

  // If we're not in ObjC++ -fexceptions, there's nothing to do.
  if (!LangOpts.CPlusPlus || !LangOpts.ObjC1 || !LangOpts.Exceptions)
    return;

  // Both the problem this endeavors to fix and the way the logic
  // above works is specific to the NeXT runtime.
  if (!LangOpts.ObjCRuntime.isNeXTFamily())
    return;

  const EHPersonality &ObjCXX = EHPersonality::get(LangOpts);
  const EHPersonality &CXX = getCXXPersonality(LangOpts);
  if (&ObjCXX == &CXX)