[PATCH] D74025: [clangd] Add the missing elaborated types in FindTarget.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 5 00:59:42 PST 2020
hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: usaxena95, kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74025
Files:
clang-tools-extra/clangd/FindTarget.cpp
clang-tools-extra/clangd/unittests/FindTargetTests.cpp
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -241,6 +241,13 @@
)cpp";
EXPECT_DECLS("TypedefTypeLoc", {"typedef S X", Rel::Alias},
{"struct S", Rel::Underlying});
+ Code = R"cpp(
+ namespace ns { struct S{}; }
+ typedef ns::S X;
+ [[X]] x;
+ )cpp";
+ EXPECT_DECLS("TypedefTypeLoc", {"typedef ns::S X", Rel::Alias},
+ {"struct S", Rel::Underlying});
// FIXME: Auto-completion in a template requires disabling delayed template
// parsing.
Index: clang-tools-extra/clangd/FindTarget.cpp
===================================================================
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -379,6 +379,10 @@
Outer.add(TT->getAsTagDecl(), Flags);
}
+ void VisitElaboratedType(const ElaboratedType* ET) {
+ Outer.add(ET->desugar(), Flags);
+ }
+
void VisitInjectedClassNameType(const InjectedClassNameType *ICNT) {
Outer.add(ICNT->getDecl(), Flags);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74025.242524.patch
Type: text/x-patch
Size: 1222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200205/70534055/attachment-0001.bin>
More information about the cfe-commits
mailing list