CmdArgs.push_back("-fexceptions");
}
+/// \brief Check if the toolchain should use the integrated assembler.
+static bool ShouldUseIntegratedAssembler(const ArgList &Args,
+ const ToolChain &TC) {
+ return Args.hasFlag(options::OPT_integrated_as,
+ options::OPT_no_integrated_as,
+ TC.IsIntegratedAssemblerDefault());
+}
+
static bool ShouldDisableCFI(const ArgList &Args,
const ToolChain &TC) {
bool Default = true;
if (TC.getTriple().isOSDarwin()) {
// The native darwin assembler doesn't support cfi directives, so
// we disable them if we think the .s file will be passed to it.
- Default = Args.hasFlag(options::OPT_integrated_as,
- options::OPT_no_integrated_as,
- TC.IsIntegratedAssemblerDefault());
+ Default = ShouldUseIntegratedAssembler(Args, TC);
}
return !Args.hasFlag(options::OPT_fdwarf2_cfi_asm,
options::OPT_fno_dwarf2_cfi_asm,
static bool ShouldDisableDwarfDirectory(const ArgList &Args,
const ToolChain &TC) {
- bool IsIADefault = TC.IsIntegratedAssemblerDefault();
- bool UseIntegratedAs = Args.hasFlag(options::OPT_integrated_as,
- options::OPT_no_integrated_as,
- IsIADefault);
bool UseDwarfDirectory = Args.hasFlag(options::OPT_fdwarf_directory_asm,
options::OPT_fno_dwarf_directory_asm,
- UseIntegratedAs);
+ ShouldUseIntegratedAssembler(Args, TC));
return !UseDwarfDirectory;
}
Args.AddAllArgs(CmdArgs, options::OPT_fmodules_ignore_macro);
// -fmodules-autolink (on by default when modules is enabled) automatically
- // links against libraries for imported modules.
- if (HaveModules &&
+ // links against libraries for imported modules. This requires the
+ // integrated assembler.
+ if (HaveModules && ShouldUseIntegratedAssembler(Args, getToolChain()) &&
Args.hasFlag(options::OPT_fmodules_autolink,
options::OPT_fno_modules_autolink,
true)) {