[llvm-commits] Quotation marks around command line arguments

Danil Malyshev dmalyshev at accesssoftek.com
Sat Jan 22 14:10:57 PST 2011


Hello everyone,

Please review the attached patch which fixes the following tests for Windows:
    LLVM :: Assembler/AutoUpgradeIntrinsics.ll
    LLVM :: Bitcode/AutoUpgradeIntrinsics.ll
    LLVM :: CodeGen/X86/2009-05-30-ISelBug.ll
    LLVM :: CodeGen/X86/change-compare-stride-0.ll
    LLVM :: CodeGen/X86/change-compare-stride-1.ll
    LLVM :: CodeGen/X86/x86-64-pic-2.ll
    LLVM :: CodeGen/X86/x86-64-pic-3.ll
    LLVM :: LLVMC/EnvParentheses.td
    LLVM :: Transforms/IndVarSimplify/preserve-gep-nested.ll
    LLVM :: Transforms/InstCombine/CPP_min_max.ll
    LLVM :: Transforms/InstCombine/sdiv-1.ll

The problem is because of the Windows command line parser consuming quotation marks and breaks the sequential calls, like

not grep "<some regexp>"

The patch adds the quotation marks around each of the command line arguments to preserve the original binding.

I have tested the patch and it doesn't show any regression and makes the listed above tests pass on Windows.

Here are more details:

Let's say the test (Assembler/AutoUpgradeIntrinsics.ll for instance) describes the following step:

; RUN: llvm-as < %s | llvm-dis | \
; RUN:   not grep {llvm\\.part\\.set\\.i\[0-9\]*\\.i\[0-9\]*\\.i\[0-9\]*}

The llvm-dis output gets redirected to the "not" utility which runs "grep" with the given argument and passes the llvm-dis output to it.
The quotation marks around the regexp will be removed at the command line parsing time and, if not restored, grep will be called with a wrong argument as

grep llvm\.part\.set\.i[0-9]*\.i[0-9]*\.i[0-9]*

That's because the current sys::Program::Execute for Windows adds quotation marks only if argument contains a space sign, which is not the case.
It is safe to always add quotation marks around arguments.
The patch is Windows-specific. No other platform is affected.

Thank you,
Danil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110122/3f42e30a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quotation01.patch
Type: application/octet-stream
Size: 1630 bytes
Desc: quotation01.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110122/3f42e30a/attachment.obj>


More information about the llvm-commits mailing list