[cfe-commits] r141328 - /cfe/trunk/lib/Driver/Compilation.cpp

Benjamin Kramer benny.kra at googlemail.com
Thu Oct 6 15:53:35 PDT 2011


Author: d0k
Date: Thu Oct  6 17:53:35 2011
New Revision: 141328

URL: http://llvm.org/viewvc/llvm-project?rev=141328&view=rev
Log:
Use strpbrk(3) instead of open coding it.

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

Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=141328&r1=141327&r2=141328&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Thu Oct  6 17:53:35 2011
@@ -70,13 +70,6 @@
   return *Entry;
 }
 
-static bool needsQuote(const char *s) {
-  for (const char *c = s; *c; ++c)
-    if (*c == ' ' || *c == '"' || *c == '\\' || *c == '$')
-      return true;
-  return false;
-}
-
 void Compilation::PrintJob(raw_ostream &OS, const Job &J,
                            const char *Terminator, bool Quote) const {
   if (const Command *C = dyn_cast<Command>(&J)) {
@@ -84,7 +77,7 @@
     for (ArgStringList::const_iterator it = C->getArguments().begin(),
            ie = C->getArguments().end(); it != ie; ++it) {
       OS << ' ';
-      if (!Quote && !needsQuote(*it)) {
+      if (!Quote && !std::strpbrk(*it, " \"\\$")) {
         OS << *it;
         continue;
       }





More information about the cfe-commits mailing list