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)
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)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits