diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-08 23:37:30 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-08 23:37:30 +0000 |
commit | 36df2904354ac150500ec16238a1ec3cce4ba83e (patch) | |
tree | b17774074b14d8c0ed28aaebb8ba8fe51711e150 /lib/Driver/Driver.cpp | |
parent | d7502d0a662b5c299125aba04245aefce67cbc22 (diff) |
Validate arguments to -arch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81281 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index f58c8829eb..59099a33e6 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -601,6 +601,16 @@ void Driver::BuildUniversalActions(const ArgList &Args, Arg *A = *it; if (A->getOption().getId() == options::OPT_arch) { + // Validate the option here; we don't save the type here because its + // particular spelling may participate in other driver choices. + llvm::Triple::ArchType Arch = + llvm::Triple::getArchTypeForDarwinArchName(A->getValue(Args)); + if (Arch == llvm::Triple::UnknownArch) { + Diag(clang::diag::err_drv_invalid_arch_name) + << A->getAsString(Args); + continue; + } + A->claim(); if (ArchNames.insert(A->getValue(Args))) Archs.push_back(A->getValue(Args)); |