]> granicus.if.org Git - clang/commitdiff
Use strpbrk(3) instead of open coding it.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 6 Oct 2011 22:53:35 +0000 (22:53 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 6 Oct 2011 22:53:35 +0000 (22:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141328 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Compilation.cpp

index baaba19ed72b32de5f1d0659b13b7502f2121950..d02da9588a639a1f5601e2c03f2df0f108441c60 100644 (file)
@@ -70,13 +70,6 @@ const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC,
   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 @@ void Compilation::PrintJob(raw_ostream &OS, const Job &J,
     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;
       }