[PATCH] D148418: [clang-tidy] Fix typedefs handling in bugprone-dangling-handle
Piotr Zegar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 15 03:32:11 PDT 2023
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))));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148418.513882.patch
Type: text/x-patch
Size: 2051 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230415/3e5a2f6d/attachment.bin>
More information about the cfe-commits
mailing list