[clang-tidy] Add a little checker for Twine locals in LLVM.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 8 Jul 2014 14:32:17 +0000 (14:32 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 8 Jul 2014 14:32:17 +0000 (14:32 +0000)
commit190e2cfd7459b5acc30f12702137ce33913b85b4
treecd97d25268318ea65f973576a3fa124afe2da34c
parenteb893a1fd688362a7809525c3b8761b77090f048
[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
clang-tools-extra/clang-tidy/llvm/CMakeLists.txt
clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp
clang-tools-extra/clang-tidy/llvm/TwineLocalCheck.cpp [new file with mode: 0644]
clang-tools-extra/clang-tidy/llvm/TwineLocalCheck.h [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/llvm-twine-local.cpp [new file with mode: 0644]