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 | 09c0eb1510818c7646cc70d9229e75cb223d3cb5 (patch) | |
tree | 320696e8502191bd27981cd2653fdeef76d9120e /clang/lib/Sema/CodeCompleteConsumer.cpp | |
parent | e41e58997c36b4f2d1071d79d84fb10419cce3bb (diff) | |
download | bcm5719-llvm-09c0eb1510818c7646cc70d9229e75cb223d3cb5.tar.gz bcm5719-llvm-09c0eb1510818c7646cc70d9229e75cb223d3cb5.zip |
Synchronize code-completion cursor kinds with indexing cursor
kinds. How shameful that this code was duplicated!
llvm-svn: 113033
Diffstat (limited to 'clang/lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r-- | clang/lib/Sema/CodeCompleteConsumer.cpp | 92 |
1 files changed, 5 insertions, 87 deletions
diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp index 1f6d3e75e2a..58a1627b478 100644 --- a/clang/lib/Sema/CodeCompleteConsumer.cpp +++ b/clang/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: |