mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
[indexer] Fix hover info of class member functions
This commit is contained in:
parent
57b95d8a8c
commit
043e9a4d44
@ -53,6 +53,20 @@ Range ResolveExtent(const CXCursor& cx_cursor, CXFile* cx_file = nullptr) {
|
|||||||
return Resolve(cx_range, cx_file);
|
return Resolve(cx_range, cx_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsLocalSemanticContainer(CXCursorKind kind) {
|
||||||
|
switch (kind) {
|
||||||
|
case CXCursor_Namespace:
|
||||||
|
case CXCursor_TranslationUnit:
|
||||||
|
case CXCursor_StructDecl:
|
||||||
|
case CXCursor_UnionDecl:
|
||||||
|
case CXCursor_ClassDecl:
|
||||||
|
case CXCursor_EnumDecl:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct NamespaceHelper {
|
struct NamespaceHelper {
|
||||||
std::unordered_map<ClangCursor, std::string>
|
std::unordered_map<ClangCursor, std::string>
|
||||||
container_cursor_to_qualified_name;
|
container_cursor_to_qualified_name;
|
||||||
@ -73,7 +87,8 @@ struct NamespaceHelper {
|
|||||||
ClangCursor cursor = container->cursor;
|
ClangCursor cursor = container->cursor;
|
||||||
std::vector<ClangCursor> namespaces;
|
std::vector<ClangCursor> namespaces;
|
||||||
std::string qualifier;
|
std::string qualifier;
|
||||||
while (cursor.get_kind() == CXCursor_Namespace) {
|
while (cursor.get_kind() != CXCursor_TranslationUnit &&
|
||||||
|
!IsLocalSemanticContainer(cursor.get_kind())) {
|
||||||
auto it = container_cursor_to_qualified_name.find(cursor);
|
auto it = container_cursor_to_qualified_name.find(cursor);
|
||||||
if (it != container_cursor_to_qualified_name.end()) {
|
if (it != container_cursor_to_qualified_name.end()) {
|
||||||
qualifier = it->second;
|
qualifier = it->second;
|
||||||
@ -274,20 +289,6 @@ IndexFile* ConsumeFile(IndexParam* param, CXFile file) {
|
|||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsLocalSemanticContainer(CXCursorKind kind) {
|
|
||||||
switch (kind) {
|
|
||||||
case CXCursor_Namespace:
|
|
||||||
case CXCursor_TranslationUnit:
|
|
||||||
case CXCursor_StructDecl:
|
|
||||||
case CXCursor_UnionDecl:
|
|
||||||
case CXCursor_ClassDecl:
|
|
||||||
case CXCursor_EnumDecl:
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if the given entity kind can be called implicitly, ie, without
|
// Returns true if the given entity kind can be called implicitly, ie, without
|
||||||
// actually being written in the source code.
|
// actually being written in the source code.
|
||||||
bool CanBeCalledImplicitly(CXIdxEntityKind kind) {
|
bool CanBeCalledImplicitly(CXIdxEntityKind kind) {
|
||||||
|
Loading…
Reference in New Issue
Block a user