diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-07-08 14:32:17 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-07-08 14:32:17 +0000 |
commit | 190e2cfd7459b5acc30f12702137ce33913b85b4 (patch) | |
tree | cd97d25268318ea65f973576a3fa124afe2da34c /clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp | |
parent | eb893a1fd688362a7809525c3b8761b77090f048 (diff) | |
download | bcm5719-llvm-190e2cfd7459b5acc30f12702137ce33913b85b4.tar.gz bcm5719-llvm-190e2cfd7459b5acc30f12702137ce33913b85b4.zip |
[clang-tidy] Add a little checker for Twine locals in LLVM.
Those often cause use after free bugs and should be generally avoided.
Technically it is safe to have a Twine with >=2 components in a variable
but I don't think it is a good pattern to follow. The almost trivial checker
comes with elaborated fix-it hints that turn the Twine into a std::string
if necessary and otherwise fall back to the original type if the Twine
is created from a single value.
llvm-svn: 212535
Diffstat (limited to 'clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp b/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp index 31a114eeebd..0586525228b 100644 --- a/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp @@ -12,6 +12,7 @@ #include "../ClangTidyModuleRegistry.h" #include "IncludeOrderCheck.h" #include "NamespaceCommentCheck.h" +#include "TwineLocalCheck.h" namespace clang { namespace tidy { @@ -24,6 +25,9 @@ public: CheckFactories.addCheckFactory( "llvm-namespace-comment", new ClangTidyCheckFactory<NamespaceCommentCheck>()); + CheckFactories.addCheckFactory( + "llvm-twine-local", + new ClangTidyCheckFactory<TwineLocalCheck>()); } }; |