[PATCH] D46427: [PDB] Quote linker arguments containing spaces (mimic MSVC)

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 16:04:29 PDT 2018


ruiu added inline comments.


================
Comment at: COFF/PDB.cpp:1068
+
+  // MSVC surrounds arguments containing spaces with quotes, so we do the same.
+  SmallString<256> ArgStr;
----------------
lantictac wrote:
> ruiu wrote:
> > Can you factor this code as `std::string quote(ArayRef<StringRef>)`?
> > 
> > I believe you also need to quote a double-quote as double double-quotes as well (but please check what the MS linker behavior is first.)
> I'm not quite sure what you meant by "quote a double-quote as double double-quotes", or at least I couldn't find or reproduce anything to support this way of escaping a double-quote. Any further clues?
> 
> Other than that, I've factored out the code into a quote() function as requested (patch pending).
I don't know if it is applicable to this field, but in Windows command line, the way to escape a single double-quote in a double-quoted string is to replace it with two double-quote characters.

For example, to get `hello "world"`, one needs to quote it as `"hello ""world"""`.

At least the way you escape a string seems ambiguous when a string contains a double-quote character.


https://reviews.llvm.org/D46427





More information about the llvm-commits mailing list