[PATCH] cpp11-migrate: Minor command-line fixes and improvements
Edwin Vane
edwin.vane at intel.com
Wed Jul 3 11:20:26 PDT 2013
================
Comment at: cpp11-migrate/tool/Cpp11Migrate.cpp:44
@@ +43,3 @@
+ "subtree:\n\n"
+ " find path/in/subtree -name '*.cpp' | xargs -I{} \\\n"
+ " cpp11-migrate -p build/path -loop-convert {}\n"
----------------
Guillaume Papin wrote:
> Edwin Vane wrote:
> > You can simplify this a bit by removing `-I{}` since the filename goes at the end of the cpp11-migrate command anyway.
> I used `-I{} cpp11-migrate <args...> {}` to have each line treated as a file, spawning one instance of `cpp11-migrate` for each file.
> Without this, `xargs` will execute `cpp11-migrate` once for all arguments, something like:
>
> cpp11-migrate <args...> a.cpp b.cpp c.cpp ...
>
> It seemed to be the most standard way (the Posix way, not a GNU extension or similar) to do it.
I think `-L 1` is the expected way to do this.
================
Comment at: cpp11-migrate/tool/Cpp11Migrate.cpp:49
@@ +48,3 @@
+ "\n"
+ " git ls-files '*.cpp' | xargs -I{} cpp11-migrate -p build/path \\\n"
+ " -use-nullptr -add-override -override-macros {}\n");
----------------
Guillaume Papin wrote:
> Edwin Vane wrote:
> > How about an example that doesn't use -p and allows you to specify compiler args after a '--'.
> The first example does this, the one just under "EXAMPLES".
>
> To give you an idea here is the example section output:
>
> EXAMPLES:
>
> Use 'auto' type specifier, no compilation database:
>
> cpp11-migrate -use-auto path/to/file.cpp -- -Ipath/to/include/
>
> Convert for loops to the new ranged-based for loops on all files in a subtree:
>
> find path/in/subtree -name '*.cpp' | xargs -I{} \
> cpp11-migrate -p build/path -loop-convert {}
>
> Make use of both nullptr and the override specifier, using git ls-files:
>
> git ls-files '*.cpp' | xargs -I{} cpp11-migrate -p build/path \
> -use-nullptr -add-override -override-macros {}
>
Ah ok. I didn't notice that. I just thought with the two xargs examples there you could have a legit reason to use `-I{}` if you didn't use `-p`.
http://llvm-reviews.chandlerc.com/D1085
More information about the cfe-commits
mailing list