================
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"
----------------
Edwin Vane wrote:
> 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.
`-L 1` has a different meaning, it doesn't take a line as an argument but as a
list of whitespace separated arguments. So files with whitespaces will break.
Using `-I{}` will break with newline in filenames, IMHO it's okay...
I changed the find line to only use `find` and it works with all files now,
even the one with newlines.
================
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");
----------------
Edwin Vane wrote:
> 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`.
Well now there is only one example with xargs, so each example is even more
different than the others now.
http://llvm-reviews.chandlerc.com/D1085
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits