[PATCH] D141592: [include-cleaner] Treat a constructor call as a use of the class type.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 12 04:17:00 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG22db1fb10b83: [include-cleaner] Treat a constructor call as a use of the class type. (authored by hokein).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141592/new/
https://reviews.llvm.org/D141592
Files:
clang-tools-extra/include-cleaner/lib/WalkAST.cpp
clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
Index: clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
===================================================================
--- clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
+++ clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
@@ -240,9 +240,10 @@
TEST(WalkAST, ConstructExprs) {
testWalk("struct $implicit^S {};", "S ^t;");
- testWalk("struct S { $implicit^S(); };", "S ^t;");
- testWalk("struct S { $explicit^S(int); };", "S ^t(42);");
- testWalk("struct S { $implicit^S(int); };", "S t = ^42;");
+ testWalk("struct $implicit^S { S(); };", "S ^t;");
+ testWalk("struct $explicit^S { S(int); };", "S ^t(42);");
+ testWalk("struct $implicit^S { S(int); };", "S t = ^42;");
+ testWalk("namespace ns { struct S{}; } using ns::$implicit^S;", "S ^t;");
}
TEST(WalkAST, Operator) {
Index: clang-tools-extra/include-cleaner/lib/WalkAST.cpp
===================================================================
--- clang-tools-extra/include-cleaner/lib/WalkAST.cpp
+++ clang-tools-extra/include-cleaner/lib/WalkAST.cpp
@@ -104,7 +104,7 @@
}
bool VisitCXXConstructExpr(CXXConstructExpr *E) {
- report(E->getLocation(), E->getConstructor(),
+ report(E->getLocation(), getMemberProvider(E->getType()),
E->getParenOrBraceRange().isValid() ? RefType::Explicit
: RefType::Implicit);
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141592.488596.patch
Type: text/x-patch
Size: 1413 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230112/246053ce/attachment.bin>
More information about the cfe-commits
mailing list