[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-12-19 Thread Eniko Donatella Toth via Phabricator via cfe-commits
NorenaLeonetti added a comment. In https://reviews.llvm.org/D33826#935394, @lebedev.ri wrote: > Ping? Hi, I'm sorry I got a bit busy, I'll get back to it next year. Repository: rL LLVM https://reviews.llvm.org/D33826 ___ cfe-commits mailing

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-25 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. Nice! /home/eenitot/new_llvm/llvm/lib/Support/ConvertUTFWrapper.cpp:38:26: warning: do not cast pointers into more strictly aligned pointer types [cert-exp36-c] UTF16 *targetStart = reinterpret_cast(ResultPtr); ^ Hmm, the

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-25 Thread Eniko Donatella Toth via Phabricator via cfe-commits
NorenaLeonetti updated this revision to Diff 116510. Repository: rL LLVM https://reviews.llvm.org/D33826 Files: clang-tidy/cert/AvoidPointerCastToMoreStrictAlignmentCheck.cpp clang-tidy/cert/AvoidPointerCastToMoreStrictAlignmentCheck.h clang-tidy/cert/CERTTidyModule.cpp

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-25 Thread Eniko Donatella Toth via Phabricator via cfe-commits
NorenaLeonetti added a comment. In https://reviews.llvm.org/D33826#866145, @lebedev.ri wrote: > In https://reviews.llvm.org/D33826#866133, @NorenaLeonetti wrote: > > > In https://reviews.llvm.org/D33826#861226, @aaron.ballman wrote: > > > > > Have you run this check over any large code bases to

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In https://reviews.llvm.org/D33826#868185, @aaron.ballman wrote: > Ah, I think I'm catching on to the point you're raising (thank you for > the patience). If the return type is void *, we don't have enough > information to sensibly diagnose (not without data flow

Re: [PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-12 Thread Aaron Ballman via cfe-commits
On Tue, Sep 12, 2017 at 1:02 PM, Roman Lebedev via Phabricator wrote: > lebedev.ri added a comment. > > In https://reviews.llvm.org/D33826#868185, @aaron.ballman wrote: > >> In https://reviews.llvm.org/D33826#868167, @lebedev.ri wrote: >> >> > In

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In https://reviews.llvm.org/D33826#868185, @aaron.ballman wrote: > In https://reviews.llvm.org/D33826#868167, @lebedev.ri wrote: > > > In https://reviews.llvm.org/D33826#868085, @aaron.ballman wrote: > > > > > In https://reviews.llvm.org/D33826#866170, @lebedev.ri

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D33826#868167, @lebedev.ri wrote: > In https://reviews.llvm.org/D33826#868085, @aaron.ballman wrote: > > > In https://reviews.llvm.org/D33826#866170, @lebedev.ri wrote: > > > > > In https://reviews.llvm.org/D33826#866161, @JonasToth

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In https://reviews.llvm.org/D33826#868085, @aaron.ballman wrote: > In https://reviews.llvm.org/D33826#866170, @lebedev.ri wrote: > > > In https://reviews.llvm.org/D33826#866161, @JonasToth wrote: > > > > > There is an exception to the general rule (EXP36-C-EX2),

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D33826#867155, @rjmccall wrote: > In https://reviews.llvm.org/D33826#866170, @lebedev.ri wrote: > > > In https://reviews.llvm.org/D33826#866161, @JonasToth wrote: > > > > > There is an exception to the general rule (EXP36-C-EX2), stating

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D33826#866170, @lebedev.ri wrote: > In https://reviews.llvm.org/D33826#866161, @JonasToth wrote: > > > There is an exception to the general rule (EXP36-C-EX2), stating that the > > result of `malloc` and friends is allowed to be casted

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-11 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In https://reviews.llvm.org/D33826#866170, @lebedev.ri wrote: > In https://reviews.llvm.org/D33826#866161, @JonasToth wrote: > > > There is an exception to the general rule (EXP36-C-EX2), stating that the > > result of `malloc` and friends is allowed to be casted to

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-11 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In https://reviews.llvm.org/D33826#866161, @JonasToth wrote: > There is an exception to the general rule (EXP36-C-EX2), stating that the > result of `malloc` and friends is allowed to be casted to stricter > alignments, since the pointer is known to be of correct

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-11 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment. There is an exception to the general rule (EXP36-C-EX2), stating that the result of `malloc` and friends is allowed to be casted to stricter alignments, since the pointer is known to be of correct alignment. Could you add a testcase for this case, i think there would

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-11 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In https://reviews.llvm.org/D33826#866133, @NorenaLeonetti wrote: > In https://reviews.llvm.org/D33826#861226, @aaron.ballman wrote: > > > Have you run this check over any large code bases to see what the quality > > of the diagnostics are? > > >

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-11 Thread Eniko Donatella Toth via Phabricator via cfe-commits
NorenaLeonetti updated this revision to Diff 114544. Repository: rL LLVM https://reviews.llvm.org/D33826 Files: clang-tidy/cert/AvoidPointerCastToMoreStrictAlignmentCheck.cpp clang-tidy/cert/AvoidPointerCastToMoreStrictAlignmentCheck.h clang-tidy/cert/CERTTidyModule.cpp

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-11 Thread Eniko Donatella Toth via Phabricator via cfe-commits
NorenaLeonetti marked an inline comment as done. NorenaLeonetti added a comment. In https://reviews.llvm.org/D33826#861226, @aaron.ballman wrote: > Have you run this check over any large code bases to see what the quality of > the diagnostics are?

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Have you run this check over any large code bases to see what the quality of the diagnostics are? Comment at: docs/clang-tidy/checks/cert-exp36-c.rst:9 + +This check is the same as `-Wcast-align`, except it checks for `reinterpret_cast` as

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-09-02 Thread Eniko Donatella Toth via Phabricator via cfe-commits
NorenaLeonetti updated this revision to Diff 113654. NorenaLeonetti added a comment. Herald added a subscriber: JDevlieghere. Added a test for C++ style cast and modified the docs. Repository: rL LLVM https://reviews.llvm.org/D33826 Files:

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-08-31 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In https://reviews.llvm.org/D33826#772676, @aaron.ballman wrote: > How does this check compare with the -Wcast-align diagnostic in the Clang > frontend? I believe that warning already covers these cases, so I'm wondering > what extra value is added with this check?

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-08-30 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In https://reviews.llvm.org/D33826#856652, @lebedev.ri wrote: > In https://reviews.llvm.org/D33826#856619, @Eugene.Zelenko wrote: > > > In https://reviews.llvm.org/D33826#856610, @lebedev.ri wrote: > > > > > Any status update here? :) > > > I generally do see a benefit

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-08-30 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a subscriber: rjmccall. lebedev.ri added a comment. In https://reviews.llvm.org/D33826#856619, @Eugene.Zelenko wrote: > In https://reviews.llvm.org/D33826#856610, @lebedev.ri wrote: > > > Any status update here? :) > > I generally do see a benefit in this check, because

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-08-30 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In https://reviews.llvm.org/D33826#856619, @Eugene.Zelenko wrote: > In https://reviews.llvm.org/D33826#856610, @lebedev.ri wrote: > > > Any status update here? :) > > I generally do see a benefit in this check, because `-Wcast-align` (at > > least currently?) does

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-08-30 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment. In https://reviews.llvm.org/D33826#856610, @lebedev.ri wrote: > Any status update here? :) > I generally do see a benefit in this check, because `-Wcast-align` (at least > currently?) does not warn on `reinterpret_cast<>()`. I think will be good idea to extend

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-08-30 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. Any status update here? :) I generally do see a benefit in this check, because `-Wcast-align` (at least currently?) does not warn on `reinterpret_cast<>()`. Repository: rL LLVM https://reviews.llvm.org/D33826 ___

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-07-06 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. What will this check say about the following code? c++ void function(void) { char c = 'x'; int *ip = reinterpret_cast(); } The clang'g `-Wcast-align` does not warn: https://godbolt.org/g/hVwD5S Repository: rL LLVM https://reviews.llvm.org/D33826

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-06-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Thank you for working on this. How does this check compare with the -Wcast-align diagnostic in the Clang frontend? I believe that warning already covers these cases, so I'm wondering what extra value is added with this check? Repository: rL LLVM

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-06-02 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments. Comment at: test/clang-tidy/cert-avoid-pointer-cast-to-more-strict-alignment.c:17 + + tmp = (struct foo_header *)(data + offset); + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: do not cast pointers into more strictly aligned pointer types

[PATCH] D33826: [clang-tidy] avoid pointer cast to more strict alignment check

2017-06-02 Thread Eniko Donatella Toth via Phabricator via cfe-commits
NorenaLeonetti created this revision. NorenaLeonetti added a project: clang-tools-extra. Herald added subscribers: xazax.hun, mgorny. Based on CERT-EXP36-C Repository: rL LLVM https://reviews.llvm.org/D33826 Files: clang-tidy/cert/AvoidPointerCastToMoreStrictAlignmentCheck.cpp