diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-02-13 18:16:28 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-02-13 18:16:28 +0000 |
commit | c56389189e7a8b99d7db3a6f60c896adb2b092bf (patch) | |
tree | b32560af01c87cf645a4ed79463d6179ccb622ca /lib/Driver/Driver.cpp | |
parent | c8bb3befcad8cd8fc9556bc265289b07dc3c94c8 (diff) |
When generating diagnostic information due to a clang failure, allow multiple
-arch options if the're all the same.
Patch by Jeremy Huddleston.
rdar://10849701
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150403 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 10eec2e1ed..26ceb32e73 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -410,21 +410,22 @@ void Driver::generateCompilationDiagnostics(Compilation &C, } // 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) |