[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-12-08 Thread Roman Lebedev via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG39431e479ffd: [clang-tidy] Introduce misc No Integer To Pointer Cast check (authored by lebedev.ri). Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-12-08 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In D91055#2440344 , @aaron.ballman wrote: > LGTM! Thank you for the review! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91055/new/ https://reviews.llvm.org/D91055 __

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-12-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM! Comment at: clang-tools-extra/clang-tidy/performance/NoIntToPtrCheck.cpp:21 + Finder->addMatcher(castExpr(hasCastKind(CK_IntegralToPointer), +

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-12-07 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri updated this revision to Diff 309976. lebedev.ri marked an inline comment as done. lebedev.ri added a comment. @aaron.ballman thank you for taking a look! Addressing review notes: - s/inttoptr/int-to-ptr/ - Adjust diagnostic to be more descriptive of the problem Repository: rG LLVM

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-12-07 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/NoIntToPtrCheck.cpp:26 + const auto *MatchedCast = Result.Nodes.getNodeAs("x"); + diag(MatchedCast->getBeginLoc(), "avoid integer to pointer casts"); +} lebedev.ri wrote: > aaron

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-12-07 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. Ugh, i really hate that inline comments aren't submitted upon uploading the new diff, it catches me off-guard each time... Comment at: clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp:40 "misc-new-delete-overloads"); +CheckFactories

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-12-07 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. There are a couple of questions from the previous iteration of the review that aren't answered yet: - the diagnostic wording doesn't actually say what's wrong with the code or how to fix it; how should users silence the diagnostic if they've found a case where it

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-12-01 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri updated this revision to Diff 308683. lebedev.ri marked 6 inline comments as done. lebedev.ri added a comment. Herald added a subscriber: phosek. @aaron.ballman @aqjune thank you for taking a look! Rebased, mostly addressed review notes: - Moved into `performance` module - Don't diagn

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-27 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-no-inttoptr.rst:12 +if you got that integral value via a pointer-to-integer cast originally, +the new pointer will lack the provenance information from the original pointer. +

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-23 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D91055#2410447 , @lebedev.ri wrote: > Ping. > If there's no pushback within next 24h i will commit this and wait for > post-commit review (if any). > Thanks. FWIW, that's not the way we usually do things, so please don't

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-22 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. Ping. If there's no pushback within next 24h i will commit this and wait for post-commit review (if any). Thanks. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91055/new/ https://reviews.llvm.org/D91055 ___

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-16 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91055/new/ https://reviews.llvm.org/D91055 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added subscribers: jeroen.dobbelaere, jdoerfert, hfinkel. aaron.ballman added a comment. In D91055#2382356 , @lebedev.ri wrote: > CC'ing @rsmith regarding the suggestion/question of also having a clang > diagnostic for this. I'm not Richard

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-09 Thread Thorsten via Phabricator via cfe-commits
tschuett added a comment. I did not consider false positives, but it provides better visibility. It is always on. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91055/new/ https://reviews.llvm.org/D91055 ___

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-09 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a subscriber: rsmith. lebedev.ri added a comment. CC'ing @rsmith regarding the suggestion/question of also having a clang diagnostic for this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91055/new/ https://reviews.llvm.org/D9105

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-09 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson added a comment. Nice! I wonder if this could be an off-by-default (maybe enabled by -Wpedantic) warning in clang instead? Diagnostics like this could be very useful for CHERI since our capabilities are in some way tracking provenance in hardware: we have bounds, permissions and a

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-09 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In D91055#2382112 , @nlopes wrote: > Nice! Why thank you. > BTW, another popular idiom is to store data in the last few bits of the > pointer (e.g., LLVM's own PointerIntPair). I guess that one can also be > implement by cas

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-09 Thread Thorsten via Phabricator via cfe-commits
tschuett added a comment. Out of curiosity: why is this in clang-tidy and not in clang? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91055/new/ https://reviews.llvm.org/D91055 ___ cfe-commits mailing li

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-09 Thread Nuno Lopes via Phabricator via cfe-commits
nlopes added a comment. Nice! BTW, another popular idiom is to store data in the last few bits of the pointer (e.g., LLVM's own PointerIntPair). I guess that one can also be implement by casting the ptr to char* and doing operations over that. Repository: rG LLVM Github Monorepo CHANGES SIN

[PATCH] D91055: [clang-tidy] Introduce misc No Integer To Pointer Cast check

2020-11-09 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri created this revision. lebedev.ri added reviewers: aaron.ballman, njames93, JonasToth. lebedev.ri added a project: LLVM. Herald added subscribers: cfe-commits, xazax.hun, mgorny. Herald added a project: clang. lebedev.ri requested review of this revision. While casting an (integral) poi