llvm-project/clang-tools-extra/clang-tidy/modernize
Nikolai Kosjar be8d03a512 [clang-tidy] Fix invalid read on destruction
...in case the clang tidy plugin is linked into the clang binary.

Valgrind's memcheck reports:

8949== Invalid read ==8866== Invalid read of size 4
8866== at 0x164D248B: fetch_sub (atomic_base.h:524)
8866== by 0x164D248B: llvm::ThreadSafeRefCountedBase<clang::ast_matchers::internal::DynMatcherInterface>::Release() const (IntrusiveRefCntPtr.h:98)
8866== by 0x164CE16C: llvm::IntrusiveRefCntPtrInfo<clang::ast_matchers::internal::DynMatcherInterface>::release(clang::ast_matchers::internal::DynMatcherInterface*) (IntrusiveRefCntPtr.h:127)
8866== by 0x164C8D5C: llvm::IntrusiveRefCntPtr<clang::ast_matchers::internal::DynMatcherInterface>::release() (IntrusiveRefCntPtr.h:190)
8866== by 0x164C3B87: llvm::IntrusiveRefCntPtr<clang::ast_matchers::internal::DynMatcherInterface>::~IntrusiveRefCntPtr() (IntrusiveRefCntPtr.h:157)
8866== by 0x164BB4F1: clang::ast_matchers::internal::DynTypedMatcher::~DynTypedMatcher() (ASTMatchersInternal.h:341)
8866== by 0x164BB529: clang::ast_matchers::internal::Matcher<clang::QualType>::~Matcher() (ASTMatchersInternal.h:496)
8866== by 0xD7AE614: __cxa_finalize (cxa_finalize.c:83)
8866== by 0x164B3082: ??? (in /d2/llvm/8/qtc/builds/DebugShared/lib/libclangTidyModernizeModule.so.8)
8866== by 0x4010B72: _dl_fini (dl-fini.c:138)
8866== by 0xD7AE040: __run_exit_handlers (exit.c:108)
8866== by 0xD7AE139: exit (exit.c:139)
8866== by 0xD78CB9D: (below main) (libc-start.c:344)
8866== Address 0x19dd9bc8 is 8 bytes inside a block of size 16 free'd
8866== at 0x4C3123B: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
8866== by 0x1469BB99: clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl::~TrueMatcherImpl() (ASTMatchersInternal.cpp:126)
8866== by 0x1469BBC5: llvm::object_deleter<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl>::call(void*) (ManagedStatic.h:30)
8866== by 0x9ABFF26: llvm::ManagedStaticBase::destroy() const (ManagedStatic.cpp:72)
8866== by 0x9ABFF94: llvm::llvm_shutdown() (ManagedStatic.cpp:84)
8866== by 0x9A65232: llvm::InitLLVM::~InitLLVM() (InitLLVM.cpp:52)
8866== by 0x14B0C8: main (driver.cpp:323)
8866== Block was alloc'd at
8866== at 0x4C3017F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
8866== by 0x1469BB36: llvm::object_creator<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl>::call() (ManagedStatic.h:24)
8866== by 0x9ABFD99: llvm::ManagedStaticBase::RegisterManagedStatic(void* (*)(), void (*)(void*)) const (ManagedStatic.cpp:42)
8866== by 0x1469B5DF: llvm::ManagedStatic<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl, llvm::object_creator<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl>, llvm::object_deleter<clang::ast_matchers::internal::(anonymous namespace)::TrueMatcherImpl> >::operator*() (ManagedStatic.h:67)
8866== by 0x14698F9D: clang::ast_matchers::internal::DynTypedMatcher::trueMatcher(clang::ast_type_traits::ASTNodeKind) (ASTMatchersInternal.cpp:195)
8866== by 0x164C9D3B: _ZNK5clang12ast_matchers8internal11TrueMatchercvNS1_7MatcherIT_EEINS_8QualTypeEEEv (ASTMatchersInternal.h:1247)
8866== by 0x16501458: __static_initialization_and_destruction_0(int, int) (LoopConvertCheck.cpp:48)
8866== by 0x16501976: _GLOBAL__sub_I_LoopConvertCheck.cpp (LoopConvertCheck.cpp:920)
8866== by 0x4010732: call_init (dl-init.c:72)
8866== by 0x4010732: _dl_init (dl-init.c:119)
8866== by 0x40010C9: ??? (in /lib/x86_64-linux-gnu/ld-2.27.so)

Differential Revision: https://reviews.llvm.org/D63129

llvm-svn: 363068
2019-06-11 14:19:09 +00:00
..
AvoidBindCheck.cpp [clang-tidy] Fixed a std::bind() transformation 2019-02-07 11:00:59 +00:00
AvoidBindCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
AvoidCArraysCheck.cpp [clang-tidy] modernize-avoid-c-arrays: avoid main function (PR40604) 2019-02-06 19:17:30 +00:00
AvoidCArraysCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
CMakeLists.txt Recommit r360345 with fixes (was reverted in r360348). 2019-05-10 16:24:28 +00:00
ConcatNestedNamespacesCheck.cpp Re-apply r357823 "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()." 2019-04-23 21:15:26 +00:00
ConcatNestedNamespacesCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
DeprecatedHeadersCheck.cpp [clang-tidy] Move all checks to the new registerPPCallbacks API 2019-03-22 18:58:12 +00:00
DeprecatedHeadersCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
DeprecatedIosBaseAliasesCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DeprecatedIosBaseAliasesCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
LoopConvertCheck.cpp [clang-tidy] Fix invalid read on destruction 2019-06-11 14:19:09 +00:00
LoopConvertCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
LoopConvertUtils.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LoopConvertUtils.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MakeSharedCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MakeSharedCheck.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MakeSmartPtrCheck.cpp [clang-tidy] Fix make-unique check to work in C++17 mode. 2019-06-03 08:14:15 +00:00
MakeSmartPtrCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
MakeUniqueCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MakeUniqueCheck.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ModernizeTidyModule.cpp Recommit r360345 with fixes (was reverted in r360348). 2019-05-10 16:24:28 +00:00
PassByValueCheck.cpp [clang-tidy] Move all checks to the new registerPPCallbacks API 2019-03-22 18:58:12 +00:00
PassByValueCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
RawStringLiteralCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RawStringLiteralCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
RedundantVoidArgCheck.cpp [clang-tidy] Fix PR28406 2019-03-29 20:55:29 +00:00
RedundantVoidArgCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
ReplaceAutoPtrCheck.cpp [clang-tidy] Move all checks to the new registerPPCallbacks API 2019-03-22 18:58:12 +00:00
ReplaceAutoPtrCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
ReplaceRandomShuffleCheck.cpp [clang-tidy] Move all checks to the new registerPPCallbacks API 2019-03-22 18:58:12 +00:00
ReplaceRandomShuffleCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
ReturnBracedInitListCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ReturnBracedInitListCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
ShrinkToFitCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ShrinkToFitCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UnaryStaticAssertCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UnaryStaticAssertCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseAutoCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseAutoCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseBoolLiteralsCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseBoolLiteralsCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseDefaultMemberInitCheck.cpp [clang-tidy] Don't use assignment for value-initialized enums 2019-02-08 19:44:42 +00:00
UseDefaultMemberInitCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseEmplaceCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseEmplaceCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseEqualsDefaultCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseEqualsDefaultCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseEqualsDeleteCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseEqualsDeleteCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseNodiscardCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseNodiscardCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseNoexceptCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseNoexceptCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseNullptrCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseNullptrCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseOverrideCheck.cpp [clang-tidy] add OverrideMacro to modernize-use-override check 2019-02-28 20:00:48 +00:00
UseOverrideCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseTrailingReturnTypeCheck.cpp [Lex] Allow to consume tokens while preprocessing 2019-05-17 09:32:05 +00:00
UseTrailingReturnTypeCheck.h Recommit r360345 with fixes (was reverted in r360348). 2019-05-10 16:24:28 +00:00
UseTransparentFunctorsCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseTransparentFunctorsCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseUncaughtExceptionsCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseUncaughtExceptionsCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00
UseUsingCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UseUsingCheck.h [clang-tidy] Switch checks to #include "ClangTidyCheck.h" 2019-03-25 12:38:26 +00:00