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

Chad Rosier mcrosier at apple.com
Thu Aug 18 10:56:33 PDT 2011


Author: mcrosier
Date: Thu Aug 18 12:56:32 2011
New Revision: 137958

URL: http://llvm.org/viewvc/llvm-project?rev=137958&view=rev
Log:
Use StringRef, rather than C string APIs.

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=137958&r1=137957&r2=137958&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 18 12:56:32 2011
@@ -2448,18 +2448,19 @@
 void darwin::CC1::RemoveCC1UnsupportedArgs(ArgStringList &CmdArgs) const {
   for (ArgStringList::iterator it = CmdArgs.begin(), ie = CmdArgs.end(); 
        it != ie;) {
-    const char *Option = *it;
+
+    StringRef Option = *it;
 
     // We only remove warning options.
-    if (strncmp(Option, "-W", 2)) {
+    if (!Option.startswith("-W")) {
       ++it;
       continue;
     }
 
-    if (strncmp(Option, "-Wno-", 5))
-      Option = &Option[2];
+    if (Option.startswith("-Wno-"))
+      Option = Option.substr(5);
     else
-      Option = &Option[5];
+      Option = Option.substr(2);
 
     bool RemoveOption = llvm::StringSwitch<bool>(Option)
       .Case("address-of-temporary", true)





More information about the cfe-commits mailing list