diff options
| author | Matthias Gehre <M.Gehre@gmx.de> | 2015-10-12 20:46:53 +0000 |
|---|---|---|
| committer | Matthias Gehre <M.Gehre@gmx.de> | 2015-10-12 20:46:53 +0000 |
| commit | a704d4bb27354a7ee54b8672808ebae9c13ba806 (patch) | |
| tree | ef26f8682ed42ef1f8dca6930dda6725796bc22f /clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt | |
| parent | 8ebfb60efa77062d12a3ecc804b8b52737b7ac1c (diff) | |
| download | bcm5719-llvm-a704d4bb27354a7ee54b8672808ebae9c13ba806.tar.gz bcm5719-llvm-a704d4bb27354a7ee54b8672808ebae9c13ba806.zip | |
[clang-tidy] add check cppcoreguidelines-pro-type-static-cast-downcast
Summary:
This check flags all usages of static_cast, where a base class is casted
to a derived class.
In those cases, a fixit is provided to convert the cast to a
dynamic_cast.
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#-type2-dont-use-static_cast-downcasts-use-dynamic_cast-instead
Depends on D13313
Reviewers: alexfh, sbenza, bkramer, aaron.ballman
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D13368
llvm-svn: 250098
Diffstat (limited to 'clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt')
| -rw-r--r-- | clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt b/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt index 5a83b3fef08..d35b9a56f94 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt @@ -4,6 +4,7 @@ add_clang_library(clangTidyCppCoreGuidelinesModule CppCoreGuidelinesTidyModule.cpp ProTypeConstCastCheck.cpp ProTypeReinterpretCastCheck.cpp + ProTypeStaticCastDowncastCheck.cpp LINK_LIBS clangAST |

