[PATCH] D35355: Fix templated type alias completion when using global completion cache
Ivan Donchevskii via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 13 07:13:55 PDT 2017
yvvan created this revision.
When we have enabled cache for global completions we did not have diagnostics for Bar and could not complete Ba as in provided code example.
template <typename T>
struct Foo { T member; };
template<typename T> using Bar = Foo<T>;
int main() {
Ba
}
https://reviews.llvm.org/D35355
Files:
lib/Frontend/ASTUnit.cpp
lib/Parse/ParseTemplate.cpp
Index: lib/Parse/ParseTemplate.cpp
===================================================================
--- lib/Parse/ParseTemplate.cpp
+++ lib/Parse/ParseTemplate.cpp
@@ -197,10 +197,11 @@
MaybeParseCXX11Attributes(prefixAttrs);
if (Tok.is(tok::kw_using)) {
- // FIXME: We should return the DeclGroup to the caller.
- ParseUsingDirectiveOrDeclaration(Context, TemplateInfo, DeclEnd,
- prefixAttrs);
- return nullptr;
+ auto usingDeclPtr = ParseUsingDirectiveOrDeclaration(Context, TemplateInfo, DeclEnd,
+ prefixAttrs);
+ if (!usingDeclPtr)
+ return nullptr;
+ return usingDeclPtr.get().getSingleDecl();
}
// Parse the declaration specifiers, stealing any diagnostics from
Index: lib/Frontend/ASTUnit.cpp
===================================================================
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -243,7 +243,8 @@
uint64_t Contexts = 0;
if (isa<TypeDecl>(ND) || isa<ObjCInterfaceDecl>(ND) ||
- isa<ClassTemplateDecl>(ND) || isa<TemplateTemplateParmDecl>(ND)) {
+ isa<ClassTemplateDecl>(ND) || isa<TemplateTemplateParmDecl>(ND) ||
+ isa<TypeAliasTemplateDecl>(ND)) {
// Types can appear in these contexts.
if (LangOpts.CPlusPlus || !isa<TagDecl>(ND))
Contexts |= (1LL << CodeCompletionContext::CCC_TopLevel)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35355.106420.patch
Type: text/x-patch
Size: 1418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170713/1bb3a9e0/attachment.bin>
More information about the cfe-commits
mailing list