[PATCH] Fixit for -Wreinterpret-case-class

Jordan Rose jordan_rose at apple.com
Thu Mar 28 10:53:24 PDT 2013


Actually, I just realized that the SourceRange here is a token range, so CreateReplacement will do the right thing even if you just pass a single location. (I realized this because you shouldn't have to do the -1 offset; CharSourceRange is a half-open range like other C++ ranges.)

Jordan


On Mar 28, 2013, at 10:43 , Alexander Zinenko <ftynse at gmail.com> wrote:

> Thanks, this approach is much simpler, please find the updated patch attached.
> 
> 
> On 28 March 2013 19:17, Jordan Rose <jordan_rose at apple.com> wrote:
> We are a long way from that being true. One more violation won't hurt today. (A quick search shows the same technique being used in Sema::CheckMain.)
> 
> Jordan
> 
> 
> On Mar 28, 2013, at 10:03 , Alexander Zinenko <ftynse at gmail.com> wrote:
> 
>> SemaDecl.cpp comment says
>> 
>> #include "clang/Lex/Preprocessor.h" // FIXME: Sema shouldn't depend on Lex
>> 
>> that's why I didn't use it.  Is it ok to use Preprocessor in Sema?
>> 
>> 
>> 
>> On 28 March 2013 18:47, Jordan Rose <jordan_rose at apple.com> wrote:
>> I don't think you actually need to pass the range around. PP.getLocForEndOfToken should work fine. (Sorry I didn't notice this the first time around.)
>> 
>> On Mar 28, 2013, at 9:35 , Alexander Zinenko <ftynse at gmail.com> wrote:
>> 
>> > Hello
>> >
>> > This patch adds fixits to -Wreinterpret-base-class proposing to replace reinterpret_cast with static_cast. It required passing SourceRange instead of SourceLocation through some calls in Sema.
>> >
>> > Review please!
>> >
>> > --
>> > Alex
>> >
>> > <13824fixit.patch>_______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> 
>> 
> 
> 
> <13824fixit.patch>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130328/c838758d/attachment.html>


More information about the cfe-commits mailing list