}
// Don't attempt to generate preprocessed files if multiple -arch options are
- // used.
- int Archs = 0;
+ // used, unless they're all duplicates.
+ llvm::StringSet<> ArchNames;
for (ArgList::const_iterator it = C.getArgs().begin(), ie = C.getArgs().end();
it != ie; ++it) {
Arg *A = *it;
if (A->getOption().matches(options::OPT_arch)) {
- Archs++;
- if (Archs > 1) {
- Diag(clang::diag::note_drv_command_failed_diag_msg)
- << "Error generating preprocessed source(s) - cannot generate "
- "preprocessed source with multiple -arch options.";
- return;
- }
+ StringRef ArchName = A->getValue(C.getArgs());
+ ArchNames.insert(ArchName);
}
}
+ if (ArchNames.size() > 1) {
+ Diag(clang::diag::note_drv_command_failed_diag_msg)
+ << "Error generating preprocessed source(s) - cannot generate "
+ "preprocessed source with multiple -arch options.";
+ return;
+ }
if (Inputs.empty()) {
Diag(clang::diag::note_drv_command_failed_diag_msg)