Simplify.

llvm-svn: 81386
This commit is contained in:
Daniel Dunbar 2009-09-09 22:32:34 +00:00
parent 5f620c1fac
commit b4a3e43741
1 changed files with 7 additions and 9 deletions

View File

@ -22,6 +22,7 @@
#include "clang/Driver/Util.h" #include "clang/Driver/Util.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Format.h" #include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
@ -383,22 +384,19 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
it = Args.begin(), ie = Args.end(); it != ie; ++it) { it = Args.begin(), ie = Args.end(); it != ie; ++it) {
const Arg *A = *it; const Arg *A = *it;
if (A->getOption().matches(options::OPT_m_x86_Features_Group)) { if (A->getOption().matches(options::OPT_m_x86_Features_Group)) {
const char *Name = A->getOption().getName(); llvm::StringRef Name = A->getOption().getName();
// Skip over "-m". // Skip over "-m".
assert(Name[0] == '-' && Name[1] == 'm' && "Invalid feature name."); assert(Name.startswith("-m") && "Invalid feature name.");
Name += 2; Name = Name.substr(2);
bool IsNegative = memcmp(Name, "no-", 3) == 0; bool IsNegative = Name.startswith("no-");
if (IsNegative) if (IsNegative)
Name += 3; Name = Name.substr(3);
A->claim(); A->claim();
CmdArgs.push_back("-target-feature"); CmdArgs.push_back("-target-feature");
CmdArgs.push_back(MakeFormattedString(Args, CmdArgs.push_back(Args.MakeArgString((IsNegative ? "-" : "+") + Name));
llvm::format("%c%s",
IsNegative ? '-' : '+',
Name)));
} }
} }