This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy][Part2] Add a new module Android and three new checks
ClosedPublic

Authored by yawanng on May 31 2017, 4:12 PM.

Diff Detail

Event Timeline

yawanng created this revision.May 31 2017, 4:12 PM
yawanng updated this revision to Diff 100938.May 31 2017, 4:19 PM
yawanng updated this revision to Diff 101254.Jun 2 2017, 11:40 AM
hokein added inline comments.Jun 7 2017, 9:38 AM
clang-tidy/utils/ExprToStr.cpp
17 ↗(On Diff #101254)

Maybe you can use clang::Lexer::getSourceText( CharSourceRange::getTokenRange(EX->getSourceRange()), ...) here? so that we don't need this utility fucntion.

yawanng updated this revision to Diff 101829.Jun 7 2017, 3:20 PM
yawanng marked an inline comment as done.
chh added inline comments.Jun 15 2017, 4:14 PM
clang-tidy/android/CreatUsageCheck.cpp
42 ↗(On Diff #101829)

Most coding styles would prefer replacement text as "open(", instead of "open (".

yawanng updated this revision to Diff 102747.Jun 15 2017, 4:24 PM
yawanng marked an inline comment as done.
yawanng updated this revision to Diff 102751.Jun 15 2017, 4:28 PM
yawanng updated this revision to Diff 103792.Jun 23 2017, 4:01 PM

Format fix.

hokein added inline comments.Jun 26 2017, 8:41 AM
clang-tidy/android/CreatUsageCheck.cpp
29 ↗(On Diff #103792)

Nit: put the returns(isInteger()) in front of hasName() (make it align with cpp function declaration).

39 ↗(On Diff #103792)

Use MatchedCall->getSourceRange().

Again, no need to create a separate variable as this variable is used only once.

docs/clang-tidy/checks/android-creat-usage.rst
6 ↗(On Diff #103792)

Would be nice to give some examples in the doc.

test/clang-tidy/android-creat-usage.cpp
9 ↗(On Diff #103792)

Could you add test cases where the second parameter is not a magic number? E.g. creat("filename", mode);.

yawanng updated this revision to Diff 103980.Jun 26 2017, 9:51 AM
yawanng marked 4 inline comments as done.
hokein accepted this revision.Jun 26 2017, 11:23 AM

Looks good.

This revision is now accepted and ready to land.Jun 26 2017, 11:23 AM
yawanng updated this revision to Diff 104559.Jun 28 2017, 5:51 PM

rename this check.

yawanng updated this revision to Diff 104561.Jun 28 2017, 6:01 PM

Format change.

chh edited edge metadata.Jun 29 2017, 10:24 AM

Summary should be updated. s/android-creat-usage/android-cloexec-creat/

yawanng closed this revision.Jun 29 2017, 10:41 AM