[PATCH] Use -std=c++11 when no arguments are provided.
Guillaume Papin
guillaume.papin at epitech.eu
Tue Aug 13 06:26:54 PDT 2013
About the include and help message, my bad, the include is necessary and the help message from the CommonOptionParser takes care of the extra-help.
For my comment about `getNumOccurrences()`. just find it weird that the value for `-p` is optional but is not marked with `cl::ValueOptional`: http://llvm.org/docs/CommandLine.html#controlling-whether-or-not-a-value-must-be-specified
This means, unless once again I'm mistaken, that if a compilation database is badly formatted this will silently fall back to the default command line.
I guess this is an issue originates from the CommonOptionsParser but since we are rolling our own here we may fix this as well.
To illustrate my issue:
- Imagine I have a BAD compile_commands.json under `/tmp/`
- Two scenarios:
1. With the build path specified as `/tmp/`:
$ cpp11-migrate -p=/tmp/ /tmp/blah.cpp
LLVM ERROR: Could not auto-detect compilation database from directory "/tmp/"
No compilation database found in /tmp/ or any parent directory
json-compilation-database: Expected array.
2. With an empty build path, so it will look starting from `/tmp/blah.cpp` directory, which is once again `/tmp/`:
$ cpp11-migrate -p="" /tmp/blah.cpp
As you can see, while both commands should have failed in the same way, the second one silently ignore the error and default back to using `std=c++11`.
I think if `-p` is used we shouldn't try to make the command line be `{ "-std=c++11" }`.
http://llvm-reviews.chandlerc.com/D1337
More information about the cfe-commits
mailing list