[PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-09-30 Thread Matthias Gehre via cfe-commits
mgehre created this revision. mgehre added a subscriber: cfe-commits. This check flags all uses of reinterpret_cast in C++ code. Use of these casts can violate type safety and cause the program to access a variable that is actually of type X to be accessed as if it were of an unrelated type Z. T

Re: [PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-09-30 Thread Vedant Kumar via cfe-commits
vsk added a subscriber: vsk. vsk added a comment. The patch lgtm. Has there been a discussion on cfe-dev about adopting these guidelines? I count well over 500 uses of reinterpret_cast in llvm+clang, so we might not all be on the same page on this. http://reviews.llvm.org/D13313 __

Re: [PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-10-01 Thread Gábor Horváth via cfe-commits
xazax.hun added a subscriber: xazax.hun. xazax.hun added a comment. If you check AvoidCStyleCastsCheck.cpp, it also suggest what kind of cast should you use to replace a C style cast. Probably, in some cases, the developers might be able to change the reinterpret_cast to something more type saf

Re: [PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-10-01 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman. aaron.ballman added reviewers: aaron.ballman, alexfh. aaron.ballman added a comment. As a slightly more broad question: I think we should have a user-customizable way to categorize these checks so that you can enable/disable them with finer-graine

Re: [PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-10-01 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. In http://reviews.llvm.org/D13313#257476, @aaron.ballman wrote: > As a slightly more broad question: I think we should have a user-customizable > way to categorize these checks so that you can enable/disable them with > finer-grained control. Some of the existing checker

Re: [PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-10-01 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. In http://reviews.llvm.org/D13313#256982, @vsk wrote: > The patch lgtm. Has there been a discussion on cfe-dev about adopting these > guidelines? > > I count well over 500 uses of reinterpret_cast in llvm+clang, so we might not > all be on the same page on this. I don'

Re: [PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-10-01 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. A high-level comment: the "misc" module is the place for checks that we didn't find (or create) a better category for. Here it's clear that we need a separate category, so we need a `CppCoreGuidelinesModule` and the `cppcoreguidelines-` check prefix. I also suggest using

Re: [PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-10-01 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment. In http://reviews.llvm.org/D13313#257506, @alexfh wrote: > In http://reviews.llvm.org/D13313#257476, @aaron.ballman wrote: > > > As a slightly more broad question: I think we should have a > > user-customizable way to categorize these checks so that you can > > en

Re: [PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-10-01 Thread Matthias Gehre via cfe-commits
mgehre updated this revision to Diff 36291. mgehre added a comment. Renamed the check to cppcoreguidelines-pro-type-reinterpret-cast http://reviews.llvm.org/D13313 Files: clang-tidy/CMakeLists.txt clang-tidy/Makefile clang-tidy/cppcoreguidelines/CMakeLists.txt clang-tidy/cppcoreguidelin

Re: [PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-10-01 Thread Matthias Gehre via cfe-commits
mgehre updated this revision to Diff 36294. mgehre added a comment. Fix add_new_check.py for capitalization of CppCoreGuidelinesTidyModule.cpp http://reviews.llvm.org/D13313 Files: clang-tidy/CMakeLists.txt clang-tidy/Makefile clang-tidy/add_new_check.py clang-tidy/cppcoreguidelines/CMa

Re: [PATCH] D13313: [clang-tidy] new check misc-no-reinterpret-cast

2015-10-01 Thread Matthias Gehre via cfe-commits
mgehre updated this revision to Diff 36296. mgehre added a comment. Read 'Check' suffix on ProTypeReinterpretCastCheck http://reviews.llvm.org/D13313 Files: clang-tidy/CMakeLists.txt clang-tidy/Makefile clang-tidy/add_new_check.py clang-tidy/cppcoreguidelines/CMakeLists.txt clang-tidy