This commit is contained in:
Fangrui Song 2018-01-20 22:55:29 -08:00
parent 6acea187c7
commit bc28bfef45
5 changed files with 9 additions and 7 deletions

View File

@ -39,7 +39,7 @@ bool ClangType::is_fundamental() const {
cx_type.kind <= CXType_LastBuiltin;
}
CXCursor ClangType::get_declaration() const {
ClangCursor ClangType::get_declaration() const {
return clang_getTypeDeclaration(cx_type);
}

View File

@ -14,6 +14,8 @@ using Usr = uint64_t;
Range ResolveCXSourceRange(const CXSourceRange& range,
CXFile* cx_file = nullptr);
class ClangCursor;
class ClangType {
public:
ClangType();
@ -24,8 +26,7 @@ class ClangType {
// Returns true if this is a fundamental type like int.
bool is_fundamental() const;
// ClangCursor is not defined so we have to return CXCursor
CXCursor get_declaration() const;
ClangCursor get_declaration() const;
std::string get_usr() const;
Usr get_usr_hash() const;
std::string get_spelling() const;

View File

@ -414,8 +414,7 @@ optional<IndexTypeId> ResolveToDeclarationType(IndexFile* db,
}
ClangCursor declaration =
ClangCursor(type.get_declaration())
.template_specialization_to_template_definition();
type.get_declaration().template_specialization_to_template_definition();
CXString cx_usr = clang_getCursorUSR(declaration.cx_cursor);
const char* str_usr = clang_getCString(cx_usr);
if (!str_usr || str_usr[0] == '\0') {

View File

@ -77,7 +77,9 @@ struct InitializeHandler : BaseMessageHandler<Ipc_InitializeRequest> {
}
g_index_builtin_types = config->index.builtin_types;
// TODO Remove enableComments
g_enable_comments = std::max(config->enableComments, config->index.comments);
if (config->index.comments > 0)
config->enableComments = config->index.comments;
g_enable_comments = config->enableComments;
// Check client version.
if (config->clientVersion.has_value() &&

View File

@ -262,7 +262,7 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
// Using -fparse-all-comments enables documententation in the indexer and in
// code completion.
if (init_opts->enableComments > 1 &&
if (init_opts->index.comments > 1 &&
!AnyStartsWith(result.args, "-fparse-all-comments")) {
result.args.push_back("-fparse-all-comments");
}