mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
In detailed_name
, remove space between *
and name
This commit is contained in:
parent
947a80ecc8
commit
95126bff61
@ -1193,8 +1193,10 @@ void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
|||||||
ns->QualifiedName(decl->semanticContainer, var->def.short_name);
|
ns->QualifiedName(decl->semanticContainer, var->def.short_name);
|
||||||
if (decl->entityInfo->kind == CXIdxEntity_EnumConstant)
|
if (decl->entityInfo->kind == CXIdxEntity_EnumConstant)
|
||||||
var->def.detailed_name = std::move(qualified_name);
|
var->def.detailed_name = std::move(qualified_name);
|
||||||
else
|
else {
|
||||||
var->def.detailed_name = type_name + " " + std::move(qualified_name);
|
var->def.detailed_name = std::move(type_name);
|
||||||
|
ConcatTypeAndName(var->def.detailed_name, qualified_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_system = clang_Location_isInSystemHeader(
|
bool is_system = clang_Location_isInSystemHeader(
|
||||||
@ -1603,10 +1605,10 @@ void OnIndexReference(CXClientData client_data, const CXIdxEntityRefInfo* ref) {
|
|||||||
// of OnIndexDeclaration. But there `decl` is of type CXIdxDeclInfo
|
// of OnIndexDeclaration. But there `decl` is of type CXIdxDeclInfo
|
||||||
// and has more information, thus not easy to reuse the code.
|
// and has more information, thus not easy to reuse the code.
|
||||||
var->def.short_name = referenced.get_spelling();
|
var->def.short_name = referenced.get_spelling();
|
||||||
std::string type_name = ToString(
|
var->def.detailed_name = ToString(
|
||||||
clang_getTypeSpelling(clang_getCursorType(referenced.cx_cursor)));
|
clang_getTypeSpelling(clang_getCursorType(referenced.cx_cursor)));
|
||||||
var->def.detailed_name = type_name + " " + var->def.short_name;
|
ConcatTypeAndName(var->def.detailed_name, var->def.short_name);
|
||||||
var->def.cls = VarClass::Member;
|
var->def.cls = VarClass::Local;
|
||||||
ClangCursor decl_cursor = referenced;
|
ClangCursor decl_cursor = referenced;
|
||||||
var->def.comments = decl_cursor.get_comments();
|
var->def.comments = decl_cursor.get_comments();
|
||||||
UniqueAdd(var->uses, ResolveSpelling(referenced.cx_cursor));
|
UniqueAdd(var->uses, ResolveSpelling(referenced.cx_cursor));
|
||||||
@ -1930,6 +1932,13 @@ std::vector<std::unique_ptr<IndexFile>> ParseWithTu(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConcatTypeAndName(std::string& type, const std::string& name) {
|
||||||
|
if (type.size() &&
|
||||||
|
(type.back() != ' ' && type.back() != '*' && type.back() != '&'))
|
||||||
|
type.push_back(' ');
|
||||||
|
type.append(name);
|
||||||
|
}
|
||||||
|
|
||||||
void IndexInit() {
|
void IndexInit() {
|
||||||
clang_enableStackTraces();
|
clang_enableStackTraces();
|
||||||
clang_toggleCrashRecovery(1);
|
clang_toggleCrashRecovery(1);
|
||||||
|
@ -578,6 +578,8 @@ std::vector<std::unique_ptr<IndexFile>> ParseWithTu(
|
|||||||
const std::vector<std::string>& args,
|
const std::vector<std::string>& args,
|
||||||
const std::vector<CXUnsavedFile>& file_contents);
|
const std::vector<CXUnsavedFile>& file_contents);
|
||||||
|
|
||||||
|
void ConcatTypeAndName(std::string& type, const std::string& name);
|
||||||
|
|
||||||
void IndexInit();
|
void IndexInit();
|
||||||
|
|
||||||
void ClangSanityCheck();
|
void ClangSanityCheck();
|
||||||
|
@ -4,13 +4,6 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void AddName(std::string& before, const std::string& name) {
|
|
||||||
if (before.size() &&
|
|
||||||
(before.back() != ' ' && before.back() != '*' && before.back() != '&'))
|
|
||||||
before.push_back(' ');
|
|
||||||
before.append(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetNameInsertingPosition(const std::string& type_desc,
|
int GetNameInsertingPosition(const std::string& type_desc,
|
||||||
const std::string& return_type) {
|
const std::string& return_type) {
|
||||||
// Check if type_desc contains an (.
|
// Check if type_desc contains an (.
|
||||||
@ -99,7 +92,7 @@ std::string GetFunctionSignature(IndexFile* db,
|
|||||||
type_desc_with_names.insert(type_desc_with_names.end(), &type_desc[i],
|
type_desc_with_names.insert(type_desc_with_names.end(), &type_desc[i],
|
||||||
&type_desc[arg.first]);
|
&type_desc[arg.first]);
|
||||||
i = arg.first;
|
i = arg.first;
|
||||||
AddName(type_desc_with_names, arg.second);
|
ConcatTypeAndName(type_desc_with_names, arg.second);
|
||||||
}
|
}
|
||||||
type_desc_with_names.insert(type_desc_with_names.end(),
|
type_desc_with_names.insert(type_desc_with_names.end(),
|
||||||
type_desc.begin() + i, type_desc.end());
|
type_desc.begin() + i, type_desc.end());
|
||||||
@ -107,7 +100,7 @@ std::string GetFunctionSignature(IndexFile* db,
|
|||||||
} else {
|
} else {
|
||||||
// type_desc is either a typedef, or some complicated type we cannot handle.
|
// type_desc is either a typedef, or some complicated type we cannot handle.
|
||||||
// Append the function_name in this case.
|
// Append the function_name in this case.
|
||||||
AddName(type_desc, function_name);
|
ConcatTypeAndName(type_desc, function_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return type_desc;
|
return type_desc;
|
||||||
|
Loading…
Reference in New Issue
Block a user