[cfe-commits] r81386 - /cfe/trunk/lib/Driver/Tools.cpp

Daniel Dunbar daniel at zuster.org
Wed Sep 9 15:32:34 PDT 2009


Author: ddunbar
Date: Wed Sep  9 17:32:34 2009
New Revision: 81386

URL: http://llvm.org/viewvc/llvm-project?rev=81386&view=rev
Log:
Simplify.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=81386&r1=81385&r2=81386&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Sep  9 17:32:34 2009
@@ -22,6 +22,7 @@
 #include "clang/Driver/Util.h"
 
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -383,22 +384,19 @@
          it = Args.begin(), ie = Args.end(); it != ie; ++it) {
     const Arg *A = *it;
     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".
-      assert(Name[0] == '-' && Name[1] == 'm' && "Invalid feature name.");
-      Name += 2;
+      assert(Name.startswith("-m") && "Invalid feature name.");
+      Name = Name.substr(2);
 
-      bool IsNegative = memcmp(Name, "no-", 3) == 0;
+      bool IsNegative = Name.startswith("no-");
       if (IsNegative)
-        Name += 3;
+        Name = Name.substr(3);
 
       A->claim();
       CmdArgs.push_back("-target-feature");
-      CmdArgs.push_back(MakeFormattedString(Args,
-                                            llvm::format("%c%s",
-                                                         IsNegative ? '-' : '+',
-                                                         Name)));
+      CmdArgs.push_back(Args.MakeArgString((IsNegative ? "-" : "+") + Name));
     }
   }
 





More information about the cfe-commits mailing list