diff options
author | Sam McCall <sam.mccall@gmail.com> | 2018-01-22 20:44:47 +0000 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2018-01-22 20:44:47 +0000 |
commit | 63c59720397bee57078a980b3e2570c3cabb6ec4 (patch) | |
tree | e41ecfc1b875d0a39988afa80179258ed9a841bf /clang/lib/Sema/SemaCodeComplete.cpp | |
parent | 1b9a4ffd6bb2622360e6bae10bbcce7348186e94 (diff) | |
download | bcm5719-llvm-63c59720397bee57078a980b3e2570c3cabb6ec4.tar.gz bcm5719-llvm-63c59720397bee57078a980b3e2570c3cabb6ec4.zip |
[CodeComplete] Omit templated constructors from member list too.
Also avoid printing a 'void' return type for constructor expressions.
llvm-svn: 323148
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index ac318a65fce..8fffa465ec9 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -843,6 +843,12 @@ void ResultBuilder::MaybeAddConstructorResults(Result R) { } } +static bool isConstructor(const Decl *ND) { + if (const auto *Tmpl = dyn_cast<FunctionTemplateDecl>(ND)) + ND = Tmpl->getTemplatedDecl(); + return isa<CXXConstructorDecl>(ND); +} + void ResultBuilder::MaybeAddResult(Result R, DeclContext *CurContext) { assert(!ShadowMaps.empty() && "Must enter into a results scope"); @@ -870,7 +876,7 @@ void ResultBuilder::MaybeAddResult(Result R, DeclContext *CurContext) { return; // C++ constructors are never found by name lookup. - if (isa<CXXConstructorDecl>(R.Declaration)) + if (isConstructor(R.Declaration)) return; ShadowMap &SMap = ShadowMaps.back(); @@ -983,7 +989,7 @@ void ResultBuilder::AddResult(Result R, DeclContext *CurContext, return; // C++ constructors are never found by name lookup. - if (isa<CXXConstructorDecl>(R.Declaration)) + if (isConstructor(R.Declaration)) return; if (Hiding && CheckHiddenResult(R, CurContext, Hiding)) @@ -2145,7 +2151,7 @@ static void AddResultTypeChunk(ASTContext &Context, // Skip constructors and conversion functions, which have their return types // built into their names. - if (isa<CXXConstructorDecl>(ND) || isa<CXXConversionDecl>(ND)) + if (isConstructor(ND) || isa<CXXConversionDecl>(ND)) return; // Determine the type of the declaration (if it has a type). |