[PATCH] D111711: [clangd] IncludeCleaner: ReferencedLocationCrawler should handle FunctionDecls
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 13 07:10:09 PDT 2021
kbobyrev updated this revision to Diff 379367.
kbobyrev added a comment.
Make the logic correct.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111711/new/
https://reviews.llvm.org/D111711
Files:
clang-tools-extra/clangd/IncludeCleaner.cpp
clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
Index: clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
+++ clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
@@ -79,6 +79,15 @@
"struct ^X { ^X(int) {} int ^foo(); };",
"auto x = X(42); auto y = x.foo();",
},
+ // Function
+ {
+ "void ^foo();",
+ "void foo() {}",
+ },
+ {
+ "inline void ^foo() {}",
+ "void bar() { foo(); }",
+ },
// Static function
{
"struct ^X { static bool ^foo(); }; bool X::^foo() {}",
Index: clang-tools-extra/clangd/IncludeCleaner.cpp
===================================================================
--- clang-tools-extra/clangd/IncludeCleaner.cpp
+++ clang-tools-extra/clangd/IncludeCleaner.cpp
@@ -39,6 +39,11 @@
return true;
}
+ bool VisitFunctionDecl(FunctionDecl *FD) {
+ add(FD);
+ return true;
+ }
+
bool VisitCXXConstructExpr(CXXConstructExpr *CCE) {
add(CCE->getConstructor());
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111711.379367.patch
Type: text/x-patch
Size: 1125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211013/586e2bdb/attachment-0001.bin>
More information about the cfe-commits
mailing list