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

Matthias Gehre via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 15:42:48 PDT 2015


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.

This rule is part of the "Type safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type1-dont-use-reinterpret_cast.

http://reviews.llvm.org/D13313

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/NoReinterpretCastCheck.cpp
  clang-tidy/misc/NoReinterpretCastCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-no-reinterpret-cast.rst
  test/clang-tidy/misc-no-reinterpret-cast.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13313.36155.patch
Type: text/x-patch
Size: 5551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150930/b6609612/attachment.bin>


More information about the cfe-commits mailing list