From 75b7128e93d736331bde659b05cd176f9dd6d047 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 18 Sep 2009 17:54:00 +0000 Subject: Handle using declarations and overload sets in code completion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82233 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/CodeCompleteConsumer.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'lib/Sema/CodeCompleteConsumer.cpp') diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp index 7dee12a3dc..b626847d62 100644 --- a/lib/Sema/CodeCompleteConsumer.cpp +++ b/lib/Sema/CodeCompleteConsumer.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// #include "clang/Sema/CodeCompleteConsumer.h" +#include "clang/AST/DeclCXX.h" #include "clang/Parse/Scope.h" #include "clang/Lex/Preprocessor.h" #include "Sema.h" @@ -123,9 +124,21 @@ void CodeCompleteConsumer::ResultSet::MaybeAddResult(Result R) { Results.push_back(R); return; } + + // Look through using declarations. + if (UsingDecl *Using = dyn_cast(R.Declaration)) + return MaybeAddResult(Result(Using->getTargetDecl(), R.Rank)); - // FIXME: Using declarations - // FIXME: Separate overload sets + // Handle each declaration in an overload set separately. + if (OverloadedFunctionDecl *Ovl + = dyn_cast(R.Declaration)) { + for (OverloadedFunctionDecl::function_iterator F = Ovl->function_begin(), + FEnd = Ovl->function_end(); + F != FEnd; ++F) + MaybeAddResult(Result(*F, R.Rank)); + + return; + } Decl *CanonDecl = R.Declaration->getCanonicalDecl(); unsigned IDNS = CanonDecl->getIdentifierNamespace(); -- cgit v1.2.3