diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-03 23:30:36 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-03 23:30:36 +0000 |
commit | e8d7bebc0dd037516dd695ee1ac2eb0923753b46 (patch) | |
tree | 9e1129df37bbdafe6ce6e8c3f73e9ea0fac343da /lib/Sema/CodeCompleteConsumer.cpp | |
parent | 469a20de757ff872c90ff6b1134f6346909ff652 (diff) |
Synchronize code-completion cursor kinds with indexing cursor
kinds. How shameful that this code was duplicated!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r-- | lib/Sema/CodeCompleteConsumer.cpp | 92 |
1 files changed, 5 insertions, 87 deletions
diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp index 1f6d3e75e2..58a1627b47 100644 --- a/lib/Sema/CodeCompleteConsumer.cpp +++ b/lib/Sema/CodeCompleteConsumer.cpp @@ -510,95 +510,13 @@ void CodeCompletionResult::computeCursorKindAndAvailability() { else if (Declaration->getAttr<DeprecatedAttr>()) Availability = CXAvailability_Deprecated; - switch (Declaration->getKind()) { - case Decl::Record: - case Decl::CXXRecord: - case Decl::ClassTemplateSpecialization: { - RecordDecl *Record = cast<RecordDecl>(Declaration); - if (Record->isStruct()) - CursorKind = CXCursor_StructDecl; - else if (Record->isUnion()) - CursorKind = CXCursor_UnionDecl; - else - CursorKind = CXCursor_ClassDecl; - break; - } - - case Decl::ObjCMethod: { - ObjCMethodDecl *Method = cast<ObjCMethodDecl>(Declaration); - if (Method->isInstanceMethod()) - CursorKind = CXCursor_ObjCInstanceMethodDecl; - else - CursorKind = CXCursor_ObjCClassMethodDecl; - break; - } - - case Decl::Typedef: - CursorKind = CXCursor_TypedefDecl; - break; - - case Decl::Enum: - CursorKind = CXCursor_EnumDecl; - break; - - case Decl::Field: - CursorKind = CXCursor_FieldDecl; - break; - - case Decl::EnumConstant: - CursorKind = CXCursor_EnumConstantDecl; - break; - - case Decl::Function: - case Decl::CXXMethod: - case Decl::CXXConstructor: - case Decl::CXXDestructor: - case Decl::CXXConversion: - CursorKind = CXCursor_FunctionDecl; - if (cast<FunctionDecl>(Declaration)->isDeleted()) + if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Declaration)) + if (Function->isDeleted()) Availability = CXAvailability_NotAvailable; - break; - - case Decl::Var: - CursorKind = CXCursor_VarDecl; - break; - - case Decl::ParmVar: - CursorKind = CXCursor_ParmDecl; - break; - - case Decl::ObjCInterface: - CursorKind = CXCursor_ObjCInterfaceDecl; - break; - - case Decl::ObjCCategory: - CursorKind = CXCursor_ObjCCategoryDecl; - break; - - case Decl::ObjCProtocol: - CursorKind = CXCursor_ObjCProtocolDecl; - break; - - case Decl::ObjCProperty: - CursorKind = CXCursor_ObjCPropertyDecl; - break; - - case Decl::ObjCIvar: - CursorKind = CXCursor_ObjCIvarDecl; - break; - - case Decl::ObjCImplementation: - CursorKind = CXCursor_ObjCImplementationDecl; - break; - - case Decl::ObjCCategoryImpl: - CursorKind = CXCursor_ObjCCategoryImplDecl; - break; - - default: + + CursorKind = getCursorKindForDecl(Declaration); + if (CursorKind == CXCursor_UnexposedDecl) CursorKind = CXCursor_NotImplemented; - break; - } break; case RK_Macro: |