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

Daniel Dunbar daniel at zuster.org
Wed Oct 5 13:02:49 PDT 2011


Hey Chad,

For consistency, it probably makes sense for this to also handle all
the cases that the quoting code handles (currently [\$" ]).

Thanks,
 - Daniel

On Wed, Oct 5, 2011 at 12:51 PM, Chad Rosier <mcrosier at apple.com> wrote:
> Author: mcrosier
> Date: Wed Oct  5 14:51:41 2011
> New Revision: 141202
>
> URL: http://llvm.org/viewvc/llvm-project?rev=141202&view=rev
> Log:
> [driver] The -v option doesn't quoted the command line arguments for historical
> reasons.  However, it does seems practical to quote strings that need it.
> rdar://10221951
>
> 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=141202&r1=141201&r2=141202&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Compilation.cpp (original)
> +++ cfe/trunk/lib/Driver/Compilation.cpp Wed Oct  5 14:51:41 2011
> @@ -70,6 +70,13 @@
>   return *Entry;
>  }
>
> +static bool needsQuote(const char *s) {
> +  for (const char *c = s; *c; ++c)
> +    if (*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)) {
> @@ -77,7 +84,7 @@
>     for (ArgStringList::const_iterator it = C->getArguments().begin(),
>            ie = C->getArguments().end(); it != ie; ++it) {
>       OS << ' ';
> -      if (!Quote) {
> +      if (!Quote && !needsQuote(*it)) {
>         OS << *it;
>         continue;
>       }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list