This is an archive of the discontinued LLVM Phabricator instance.

[Tooling] Add a factory method for CommonOptionsParser
ClosedPublic

Authored by ioeric on Oct 18 2017, 2:30 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ioeric created this revision.Oct 18 2017, 2:30 AM
hokein added inline comments.Oct 18 2017, 4:58 AM
include/clang/Tooling/CommonOptionsParser.h
95 ↗(On Diff #119446)

worth some documentation?

115 ↗(On Diff #119446)

We can get rid of the static here by calling parser->init(XXX).

lib/Tooling/CommonOptionsParser.cpp
165 ↗(On Diff #119446)

nit: using llvm::make_unique.

ioeric updated this revision to Diff 119465.Oct 18 2017, 5:17 AM
ioeric marked 2 inline comments as done.
  • Address review comments.
ioeric added inline comments.Oct 18 2017, 5:17 AM
include/clang/Tooling/CommonOptionsParser.h
115 ↗(On Diff #119446)

Ha, right!

lib/Tooling/CommonOptionsParser.cpp
165 ↗(On Diff #119446)

make_unique didn't work because the constructor here is private...

hokein accepted this revision.Oct 18 2017, 5:38 AM

Looks good from my side. You might want @klimek to take a look before committing.

include/clang/Tooling/CommonOptionsParser.h
90 ↗(On Diff #119465)

This change is unintended?

118 ↗(On Diff #119465)

nit: the code indention seems wrong after updated.

lib/Tooling/CommonOptionsParser.cpp
165 ↗(On Diff #119446)

Ah, I see.

This revision is now accepted and ready to land.Oct 18 2017, 5:38 AM
ioeric updated this revision to Diff 119502.Oct 18 2017, 10:46 AM
  • Move unique_ptr result.
ioeric updated this revision to Diff 119583.Oct 19 2017, 7:31 AM
  • Make the factory method return an expected object instead of unique_ptr.
  • clang-format code.
hokein accepted this revision.Oct 19 2017, 9:12 AM

Still LGTM.

This revision was automatically updated to reflect the committed changes.