Set __EXCEPTIONS by checking on darwin's triple.

Patch by Rafael Espindola.

llvm-svn: 83209
This commit is contained in:
Fariborz Jahanian 2009-10-01 20:30:46 +00:00
parent be3039e776
commit e4b21aba44
1 changed files with 8 additions and 3 deletions

View File

@ -472,7 +472,8 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
}
}
static bool needsExceptions(const ArgList &Args, types::ID InputType) {
static bool needsExceptions(const ArgList &Args, types::ID InputType,
const llvm::Triple &Triple) {
if (Arg *A = Args.getLastArg(options::OPT_fexceptions,
options::OPT_fno_exceptions)) {
if (A->getOption().matches(options::OPT_fexceptions))
@ -486,12 +487,16 @@ static bool needsExceptions(const ArgList &Args, types::ID InputType) {
case types::TY_ObjCXX: case types::TY_ObjCXXHeader:
case types::TY_PP_ObjCXX: case types::TY_PP_ObjCXXHeader:
return true;
case types::TY_ObjC: case types::TY_ObjCHeader:
case types::TY_PP_ObjC: case types::TY_PP_ObjCHeader:
if (Args.hasArg(options::OPT_fobjc_nonfragile_abi))
return true;
else
if (Triple.getOS() != llvm::Triple::Darwin)
return false;
return (Triple.getDarwinMajorNumber() >= 9 &&
Triple.getArch() == llvm::Triple::x86_64);
default:
return false;
}
@ -833,7 +838,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-fblocks=0");
}
if (needsExceptions(Args, InputType))
if (needsExceptions(Args, InputType, getToolChain().getTriple()))
CmdArgs.push_back("-fexceptions");
else
CmdArgs.push_back("-fexceptions=0");