This revision was automatically updated to reflect the committed changes. PiotrZSL marked an inline comment as done. Closed by commit rG35f466eb14b7: [clang-tidy] Fix typedefs handling in bugprone-dangling-handle (authored by PiotrZSL).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148418/new/ https://reviews.llvm.org/D148418 Files: clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp clang-tools-extra/docs/ReleaseNotes.rst clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp +++ clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp @@ -52,7 +52,8 @@ basic_string(); basic_string(const char*); - operator basic_string_view() const noexcept; + typedef basic_string_view str_view; + operator str_view() const noexcept; ~basic_string(); }; @@ -193,3 +194,4 @@ TakesAStringView(std::string()); } + Index: clang-tools-extra/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/docs/ReleaseNotes.rst +++ clang-tools-extra/docs/ReleaseNotes.rst @@ -174,6 +174,10 @@ arguments to ``std::print``, ``std::format`` or other functions listed in the ``StringParameterFunction`` check option. +- Improved :doc:`bugprone-dangling-handle + <clang-tidy/checks/bugprone/dangling-handle>` check enhancing detection of + handles behind type aliases. + - Deprecated check-local options `HeaderFileExtensions` in :doc:`bugprone-dynamic-static-initializers <clang-tidy/checks/bugprone/dynamic-static-initializers>` check. Index: clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp +++ clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp @@ -25,7 +25,8 @@ return expr( anyOf(cxxConstructExpr(hasDeclaration(cxxMethodDecl(ofClass(IsAHandle))), hasArgument(0, Arg)), - cxxMemberCallExpr(hasType(cxxRecordDecl(IsAHandle)), + cxxMemberCallExpr(hasType(hasUnqualifiedDesugaredType(recordType( + hasDeclaration(cxxRecordDecl(IsAHandle))))), callee(memberExpr(member(cxxConversionDecl()))), on(Arg)))); }
Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp +++ clang-tools-extra/test/clang-tidy/checkers/bugprone/dangling-handle.cpp @@ -52,7 +52,8 @@ basic_string(); basic_string(const char*); - operator basic_string_view() const noexcept; + typedef basic_string_view str_view; + operator str_view() const noexcept; ~basic_string(); }; @@ -193,3 +194,4 @@ TakesAStringView(std::string()); } + Index: clang-tools-extra/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/docs/ReleaseNotes.rst +++ clang-tools-extra/docs/ReleaseNotes.rst @@ -174,6 +174,10 @@ arguments to ``std::print``, ``std::format`` or other functions listed in the ``StringParameterFunction`` check option. +- Improved :doc:`bugprone-dangling-handle + <clang-tidy/checks/bugprone/dangling-handle>` check enhancing detection of + handles behind type aliases. + - Deprecated check-local options `HeaderFileExtensions` in :doc:`bugprone-dynamic-static-initializers <clang-tidy/checks/bugprone/dynamic-static-initializers>` check. Index: clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp +++ clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp @@ -25,7 +25,8 @@ return expr( anyOf(cxxConstructExpr(hasDeclaration(cxxMethodDecl(ofClass(IsAHandle))), hasArgument(0, Arg)), - cxxMemberCallExpr(hasType(cxxRecordDecl(IsAHandle)), + cxxMemberCallExpr(hasType(hasUnqualifiedDesugaredType(recordType( + hasDeclaration(cxxRecordDecl(IsAHandle))))), callee(memberExpr(member(cxxConversionDecl()))), on(Arg)))); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits