In the compilation database command must be escaped. This can cause problems on some systems (Windows). cmd is added as a list of command line arguments that will not be escaped.
Details
Diff Detail
Event Timeline
Small aside: phab helps mainly when context is added to the diff (see http://llvm.org/docs/Phabricator.html)
git: git diff -U999999 other-branch
svn: svn diff --diff-cmd=diff -x -U999999
(or you can use the arc diff command line tool)
Apart from that, my comment on the initial thread still stands:
I think we should name the list one "arguments" or (if you prefer) "args"; I think that makes a lot more sense: command: the shell command that is run, arguments: the command line arguments.
I did the rename to args, but apparently I uploaded the old patch file. New patch file coming shortly.
Sorry I missed the update - I still see "cmd" in the latest patch (note
that phab is currently down due to somebody trying to DDOS or hack it).
I'm trying to upload a new patch and I get an error from Phabricator:
'Unhandled Exception ("Exception")'.
Any ideas how to get this to work? I have attached the diff file.
../llvm/tools/clang/lib/Tooling/JSONCompilationDatabase.cpp | ||
---|---|---|
301 | I don't see how the arguments are preferred. I was thinking that the user would either want to use the command line or list arguments. Is there a case where someone would want to do both? Also, if we permit both, do we need to do any kind of uniquing? | |
304–306 | I changed two other locations to range-based for loops, too. |
../llvm/tools/clang/lib/Tooling/JSONCompilationDatabase.cpp | ||
---|---|---|
301 | You're probably right. I guess people are not distributing clang tools (yet!), so we probably don't need tools like cmake to output both at the same time. What I meant with "preferred" is that we could allow specifying both, and then we would use 'arguments', if specified, and otherwise fall back to 'command'. Does that make sense? | |
304–306 | Thanks! |
Arguments and Command can now be in the same compilation database for the same file. Arguments are preferred when both are present.
LG with a happy path test.
../llvm/tools/clang/unittests/Tooling/CompilationDatabaseTest.cpp | ||
---|---|---|
45 | Please add a happy path test, too. |
Where/how does documentation (http://clang.llvm.org/docs/JSONCompilationDatabase.html) get updated?
Added test for command and arguments in same object.
Fixed bug where parse failed if command and argument resolved to empty lists.
Any reason we don't want to allow both, but prefer the arguments?