mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 09:31:59 +00:00
Move libclangmm/Utility.h into clang_utils.h
This commit is contained in:
parent
172f9e2e80
commit
7d549f3fdf
@ -1,7 +1,6 @@
|
|||||||
#include "clang_complete.h"
|
#include "clang_complete.h"
|
||||||
|
|
||||||
#include "clang_utils.h"
|
#include "clang_utils.h"
|
||||||
#include "libclangmm/Utility.h"
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
@ -184,7 +183,7 @@ void BuildDetailString(CXCompletionString completion_string,
|
|||||||
|
|
||||||
case CXCompletionChunk_Placeholder: {
|
case CXCompletionChunk_Placeholder: {
|
||||||
std::string text =
|
std::string text =
|
||||||
clang::ToString(clang_getCompletionChunkText(completion_string, i));
|
ToString(clang_getCompletionChunkText(completion_string, i));
|
||||||
parameters->push_back(text);
|
parameters->push_back(text);
|
||||||
detail += text;
|
detail += text;
|
||||||
insert += "${" + std::to_string(parameters->size()) + ":" + text + "}";
|
insert += "${" + std::to_string(parameters->size()) + ":" + text + "}";
|
||||||
@ -198,7 +197,7 @@ void BuildDetailString(CXCompletionString completion_string,
|
|||||||
|
|
||||||
case CXCompletionChunk_TypedText: {
|
case CXCompletionChunk_TypedText: {
|
||||||
std::string text =
|
std::string text =
|
||||||
clang::ToString(clang_getCompletionChunkText(completion_string, i));
|
ToString(clang_getCompletionChunkText(completion_string, i));
|
||||||
label = text;
|
label = text;
|
||||||
detail += text;
|
detail += text;
|
||||||
insert += text;
|
insert += text;
|
||||||
@ -207,21 +206,20 @@ void BuildDetailString(CXCompletionString completion_string,
|
|||||||
|
|
||||||
case CXCompletionChunk_Text: {
|
case CXCompletionChunk_Text: {
|
||||||
std::string text =
|
std::string text =
|
||||||
clang::ToString(clang_getCompletionChunkText(completion_string, i));
|
ToString(clang_getCompletionChunkText(completion_string, i));
|
||||||
detail += text;
|
detail += text;
|
||||||
insert += text;
|
insert += text;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CXCompletionChunk_Informative: {
|
case CXCompletionChunk_Informative: {
|
||||||
detail +=
|
detail += ToString(clang_getCompletionChunkText(completion_string, i));
|
||||||
clang::ToString(clang_getCompletionChunkText(completion_string, i));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CXCompletionChunk_ResultType: {
|
case CXCompletionChunk_ResultType: {
|
||||||
CXString text = clang_getCompletionChunkText(completion_string, i);
|
CXString text = clang_getCompletionChunkText(completion_string, i);
|
||||||
std::string new_detail = clang::ToString(text) + detail + " ";
|
std::string new_detail = ToString(text) + detail + " ";
|
||||||
detail = new_detail;
|
detail = new_detail;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -441,7 +439,7 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
|
|||||||
ls_completion_item.insertText,
|
ls_completion_item.insertText,
|
||||||
&ls_completion_item.parameters_);
|
&ls_completion_item.parameters_);
|
||||||
ls_completion_item.insertText += "$0";
|
ls_completion_item.insertText += "$0";
|
||||||
ls_completion_item.documentation = clang::ToString(
|
ls_completion_item.documentation = ToString(
|
||||||
clang_getCompletionBriefComment(result.CompletionString));
|
clang_getCompletionBriefComment(result.CompletionString));
|
||||||
ls_completion_item.sortText =
|
ls_completion_item.sortText =
|
||||||
(const char)uint64_t(GetCompletionPriority(
|
(const char)uint64_t(GetCompletionPriority(
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "clang_utils.h"
|
#include "clang_utils.h"
|
||||||
|
|
||||||
#include "libclangmm/Utility.h"
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -46,12 +45,11 @@ optional<lsDiagnostic> BuildAndDisposeDiagnostic(CXDiagnostic diagnostic,
|
|||||||
ls_diagnostic.range =
|
ls_diagnostic.range =
|
||||||
lsRange(lsPosition(line - 1, column), lsPosition(line - 1, column));
|
lsRange(lsPosition(line - 1, column), lsPosition(line - 1, column));
|
||||||
|
|
||||||
ls_diagnostic.message =
|
ls_diagnostic.message = ToString(clang_getDiagnosticSpelling(diagnostic));
|
||||||
clang::ToString(clang_getDiagnosticSpelling(diagnostic));
|
|
||||||
|
|
||||||
// Append the flag that enables this diagnostic, ie, [-Wswitch]
|
// Append the flag that enables this diagnostic, ie, [-Wswitch]
|
||||||
std::string enabling_flag =
|
std::string enabling_flag =
|
||||||
clang::ToString(clang_getDiagnosticOption(diagnostic, nullptr));
|
ToString(clang_getDiagnosticOption(diagnostic, nullptr));
|
||||||
if (!enabling_flag.empty())
|
if (!enabling_flag.empty())
|
||||||
ls_diagnostic.message += " [" + enabling_flag + "]";
|
ls_diagnostic.message += " [" + enabling_flag + "]";
|
||||||
|
|
||||||
@ -78,7 +76,7 @@ optional<lsDiagnostic> BuildAndDisposeDiagnostic(CXDiagnostic diagnostic,
|
|||||||
CXString text = clang_getDiagnosticFixIt(diagnostic, i, &replacement_range);
|
CXString text = clang_getDiagnosticFixIt(diagnostic, i, &replacement_range);
|
||||||
|
|
||||||
lsTextEdit edit;
|
lsTextEdit edit;
|
||||||
edit.newText = clang::ToString(text);
|
edit.newText = ToString(text);
|
||||||
edit.range = GetLsRangeForFixIt(replacement_range);
|
edit.range = GetLsRangeForFixIt(replacement_range);
|
||||||
ls_diagnostic.fixits_.push_back(edit);
|
ls_diagnostic.fixits_.push_back(edit);
|
||||||
}
|
}
|
||||||
@ -90,6 +88,338 @@ optional<lsDiagnostic> BuildAndDisposeDiagnostic(CXDiagnostic diagnostic,
|
|||||||
|
|
||||||
std::string FileName(CXFile file) {
|
std::string FileName(CXFile file) {
|
||||||
CXString cx_name = clang_getFileName(file);
|
CXString cx_name = clang_getFileName(file);
|
||||||
std::string name = clang::ToString(cx_name);
|
std::string name = ToString(cx_name);
|
||||||
return NormalizePath(name);
|
return NormalizePath(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ToString(CXString cx_string) {
|
||||||
|
std::string string;
|
||||||
|
if (cx_string.data != nullptr) {
|
||||||
|
string = clang_getCString(cx_string);
|
||||||
|
clang_disposeString(cx_string);
|
||||||
|
}
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ToString(CXCursorKind kind) {
|
||||||
|
switch (kind) {
|
||||||
|
case CXCursor_UnexposedDecl:
|
||||||
|
return "UnexposedDecl";
|
||||||
|
case CXCursor_StructDecl:
|
||||||
|
return "StructDecl";
|
||||||
|
case CXCursor_UnionDecl:
|
||||||
|
return "UnionDecl";
|
||||||
|
case CXCursor_ClassDecl:
|
||||||
|
return "ClassDecl";
|
||||||
|
case CXCursor_EnumDecl:
|
||||||
|
return "EnumDecl";
|
||||||
|
case CXCursor_FieldDecl:
|
||||||
|
return "FieldDecl";
|
||||||
|
case CXCursor_EnumConstantDecl:
|
||||||
|
return "EnumConstantDecl";
|
||||||
|
case CXCursor_FunctionDecl:
|
||||||
|
return "FunctionDecl";
|
||||||
|
case CXCursor_VarDecl:
|
||||||
|
return "VarDecl";
|
||||||
|
case CXCursor_ParmDecl:
|
||||||
|
return "ParmDecl";
|
||||||
|
case CXCursor_ObjCInterfaceDecl:
|
||||||
|
return "ObjCInterfaceDecl";
|
||||||
|
case CXCursor_ObjCCategoryDecl:
|
||||||
|
return "ObjCCategoryDecl";
|
||||||
|
case CXCursor_ObjCProtocolDecl:
|
||||||
|
return "ObjCProtocolDecl";
|
||||||
|
case CXCursor_ObjCPropertyDecl:
|
||||||
|
return "ObjCPropertyDecl";
|
||||||
|
case CXCursor_ObjCIvarDecl:
|
||||||
|
return "ObjCIvarDecl";
|
||||||
|
case CXCursor_ObjCInstanceMethodDecl:
|
||||||
|
return "ObjCInstanceMethodDecl";
|
||||||
|
case CXCursor_ObjCClassMethodDecl:
|
||||||
|
return "ObjCClassMethodDecl";
|
||||||
|
case CXCursor_ObjCImplementationDecl:
|
||||||
|
return "ObjCImplementationDecl";
|
||||||
|
case CXCursor_ObjCCategoryImplDecl:
|
||||||
|
return "ObjCCategoryImplDecl";
|
||||||
|
case CXCursor_TypedefDecl:
|
||||||
|
return "TypedefDecl";
|
||||||
|
case CXCursor_CXXMethod:
|
||||||
|
return "CXXMethod";
|
||||||
|
case CXCursor_Namespace:
|
||||||
|
return "Namespace";
|
||||||
|
case CXCursor_LinkageSpec:
|
||||||
|
return "LinkageSpec";
|
||||||
|
case CXCursor_Constructor:
|
||||||
|
return "Constructor";
|
||||||
|
case CXCursor_Destructor:
|
||||||
|
return "Destructor";
|
||||||
|
case CXCursor_ConversionFunction:
|
||||||
|
return "ConversionFunction";
|
||||||
|
case CXCursor_TemplateTypeParameter:
|
||||||
|
return "TemplateTypeParameter";
|
||||||
|
case CXCursor_NonTypeTemplateParameter:
|
||||||
|
return "NonTypeTemplateParameter";
|
||||||
|
case CXCursor_TemplateTemplateParameter:
|
||||||
|
return "TemplateTemplateParameter";
|
||||||
|
case CXCursor_FunctionTemplate:
|
||||||
|
return "FunctionTemplate";
|
||||||
|
case CXCursor_ClassTemplate:
|
||||||
|
return "ClassTemplate";
|
||||||
|
case CXCursor_ClassTemplatePartialSpecialization:
|
||||||
|
return "ClassTemplatePartialSpecialization";
|
||||||
|
case CXCursor_NamespaceAlias:
|
||||||
|
return "NamespaceAlias";
|
||||||
|
case CXCursor_UsingDirective:
|
||||||
|
return "UsingDirective";
|
||||||
|
case CXCursor_UsingDeclaration:
|
||||||
|
return "UsingDeclaration";
|
||||||
|
case CXCursor_TypeAliasDecl:
|
||||||
|
return "TypeAliasDecl";
|
||||||
|
case CXCursor_ObjCSynthesizeDecl:
|
||||||
|
return "ObjCSynthesizeDecl";
|
||||||
|
case CXCursor_ObjCDynamicDecl:
|
||||||
|
return "ObjCDynamicDecl";
|
||||||
|
case CXCursor_CXXAccessSpecifier:
|
||||||
|
return "CXXAccessSpecifier";
|
||||||
|
// case CXCursor_FirstDecl: return "FirstDecl";
|
||||||
|
// case CXCursor_LastDecl: return "LastDecl";
|
||||||
|
// case CXCursor_FirstRef: return "FirstRef";
|
||||||
|
case CXCursor_ObjCSuperClassRef:
|
||||||
|
return "ObjCSuperClassRef";
|
||||||
|
case CXCursor_ObjCProtocolRef:
|
||||||
|
return "ObjCProtocolRef";
|
||||||
|
case CXCursor_ObjCClassRef:
|
||||||
|
return "ObjCClassRef";
|
||||||
|
case CXCursor_TypeRef:
|
||||||
|
return "TypeRef";
|
||||||
|
case CXCursor_CXXBaseSpecifier:
|
||||||
|
return "CXXBaseSpecifier";
|
||||||
|
case CXCursor_TemplateRef:
|
||||||
|
return "TemplateRef";
|
||||||
|
case CXCursor_NamespaceRef:
|
||||||
|
return "NamespaceRef";
|
||||||
|
case CXCursor_MemberRef:
|
||||||
|
return "MemberRef";
|
||||||
|
case CXCursor_LabelRef:
|
||||||
|
return "LabelRef";
|
||||||
|
case CXCursor_OverloadedDeclRef:
|
||||||
|
return "OverloadedDeclRef";
|
||||||
|
case CXCursor_VariableRef:
|
||||||
|
return "VariableRef";
|
||||||
|
// case CXCursor_LastRef: return "LastRef";
|
||||||
|
// case CXCursor_FirstInvalid: return "FirstInvalid";
|
||||||
|
case CXCursor_InvalidFile:
|
||||||
|
return "InvalidFile";
|
||||||
|
case CXCursor_NoDeclFound:
|
||||||
|
return "NoDeclFound";
|
||||||
|
case CXCursor_NotImplemented:
|
||||||
|
return "NotImplemented";
|
||||||
|
case CXCursor_InvalidCode:
|
||||||
|
return "InvalidCode";
|
||||||
|
// case CXCursor_LastInvalid: return "LastInvalid";
|
||||||
|
// case CXCursor_FirstExpr: return "FirstExpr";
|
||||||
|
case CXCursor_UnexposedExpr:
|
||||||
|
return "UnexposedExpr";
|
||||||
|
case CXCursor_DeclRefExpr:
|
||||||
|
return "DeclRefExpr";
|
||||||
|
case CXCursor_MemberRefExpr:
|
||||||
|
return "MemberRefExpr";
|
||||||
|
case CXCursor_CallExpr:
|
||||||
|
return "CallExpr";
|
||||||
|
case CXCursor_ObjCMessageExpr:
|
||||||
|
return "ObjCMessageExpr";
|
||||||
|
case CXCursor_BlockExpr:
|
||||||
|
return "BlockExpr";
|
||||||
|
case CXCursor_IntegerLiteral:
|
||||||
|
return "IntegerLiteral";
|
||||||
|
case CXCursor_FloatingLiteral:
|
||||||
|
return "FloatingLiteral";
|
||||||
|
case CXCursor_ImaginaryLiteral:
|
||||||
|
return "ImaginaryLiteral";
|
||||||
|
case CXCursor_StringLiteral:
|
||||||
|
return "StringLiteral";
|
||||||
|
case CXCursor_CharacterLiteral:
|
||||||
|
return "CharacterLiteral";
|
||||||
|
case CXCursor_ParenExpr:
|
||||||
|
return "ParenExpr";
|
||||||
|
case CXCursor_UnaryOperator:
|
||||||
|
return "UnaryOperator";
|
||||||
|
case CXCursor_ArraySubscriptExpr:
|
||||||
|
return "ArraySubscriptExpr";
|
||||||
|
case CXCursor_BinaryOperator:
|
||||||
|
return "BinaryOperator";
|
||||||
|
case CXCursor_CompoundAssignOperator:
|
||||||
|
return "CompoundAssignOperator";
|
||||||
|
case CXCursor_ConditionalOperator:
|
||||||
|
return "ConditionalOperator";
|
||||||
|
case CXCursor_CStyleCastExpr:
|
||||||
|
return "CStyleCastExpr";
|
||||||
|
case CXCursor_CompoundLiteralExpr:
|
||||||
|
return "CompoundLiteralExpr";
|
||||||
|
case CXCursor_InitListExpr:
|
||||||
|
return "InitListExpr";
|
||||||
|
case CXCursor_AddrLabelExpr:
|
||||||
|
return "AddrLabelExpr";
|
||||||
|
case CXCursor_StmtExpr:
|
||||||
|
return "StmtExpr";
|
||||||
|
case CXCursor_GenericSelectionExpr:
|
||||||
|
return "GenericSelectionExpr";
|
||||||
|
case CXCursor_GNUNullExpr:
|
||||||
|
return "GNUNullExpr";
|
||||||
|
case CXCursor_CXXStaticCastExpr:
|
||||||
|
return "CXXStaticCastExpr";
|
||||||
|
case CXCursor_CXXDynamicCastExpr:
|
||||||
|
return "CXXDynamicCastExpr";
|
||||||
|
case CXCursor_CXXReinterpretCastExpr:
|
||||||
|
return "CXXReinterpretCastExpr";
|
||||||
|
case CXCursor_CXXConstCastExpr:
|
||||||
|
return "CXXConstCastExpr";
|
||||||
|
case CXCursor_CXXFunctionalCastExpr:
|
||||||
|
return "CXXFunctionalCastExpr";
|
||||||
|
case CXCursor_CXXTypeidExpr:
|
||||||
|
return "CXXTypeidExpr";
|
||||||
|
case CXCursor_CXXBoolLiteralExpr:
|
||||||
|
return "CXXBoolLiteralExpr";
|
||||||
|
case CXCursor_CXXNullPtrLiteralExpr:
|
||||||
|
return "CXXNullPtrLiteralExpr";
|
||||||
|
case CXCursor_CXXThisExpr:
|
||||||
|
return "CXXThisExpr";
|
||||||
|
case CXCursor_CXXThrowExpr:
|
||||||
|
return "CXXThrowExpr";
|
||||||
|
case CXCursor_CXXNewExpr:
|
||||||
|
return "CXXNewExpr";
|
||||||
|
case CXCursor_CXXDeleteExpr:
|
||||||
|
return "CXXDeleteExpr";
|
||||||
|
case CXCursor_UnaryExpr:
|
||||||
|
return "UnaryExpr";
|
||||||
|
case CXCursor_ObjCStringLiteral:
|
||||||
|
return "ObjCStringLiteral";
|
||||||
|
case CXCursor_ObjCEncodeExpr:
|
||||||
|
return "ObjCEncodeExpr";
|
||||||
|
case CXCursor_ObjCSelectorExpr:
|
||||||
|
return "ObjCSelectorExpr";
|
||||||
|
case CXCursor_ObjCProtocolExpr:
|
||||||
|
return "ObjCProtocolExpr";
|
||||||
|
case CXCursor_ObjCBridgedCastExpr:
|
||||||
|
return "ObjCBridgedCastExpr";
|
||||||
|
case CXCursor_PackExpansionExpr:
|
||||||
|
return "PackExpansionExpr";
|
||||||
|
case CXCursor_SizeOfPackExpr:
|
||||||
|
return "SizeOfPackExpr";
|
||||||
|
case CXCursor_LambdaExpr:
|
||||||
|
return "LambdaExpr";
|
||||||
|
case CXCursor_ObjCBoolLiteralExpr:
|
||||||
|
return "ObjCBoolLiteralExpr";
|
||||||
|
case CXCursor_ObjCSelfExpr:
|
||||||
|
return "ObjCSelfExpr";
|
||||||
|
// case CXCursor_LastExpr: return "LastExpr";
|
||||||
|
// case CXCursor_FirstStmt: return "FirstStmt";
|
||||||
|
case CXCursor_UnexposedStmt:
|
||||||
|
return "UnexposedStmt";
|
||||||
|
case CXCursor_LabelStmt:
|
||||||
|
return "LabelStmt";
|
||||||
|
case CXCursor_CompoundStmt:
|
||||||
|
return "CompoundStmt";
|
||||||
|
case CXCursor_CaseStmt:
|
||||||
|
return "CaseStmt";
|
||||||
|
case CXCursor_DefaultStmt:
|
||||||
|
return "DefaultStmt";
|
||||||
|
case CXCursor_IfStmt:
|
||||||
|
return "IfStmt";
|
||||||
|
case CXCursor_SwitchStmt:
|
||||||
|
return "SwitchStmt";
|
||||||
|
case CXCursor_WhileStmt:
|
||||||
|
return "WhileStmt";
|
||||||
|
case CXCursor_DoStmt:
|
||||||
|
return "DoStmt";
|
||||||
|
case CXCursor_ForStmt:
|
||||||
|
return "ForStmt";
|
||||||
|
case CXCursor_GotoStmt:
|
||||||
|
return "GotoStmt";
|
||||||
|
case CXCursor_IndirectGotoStmt:
|
||||||
|
return "IndirectGotoStmt";
|
||||||
|
case CXCursor_ContinueStmt:
|
||||||
|
return "ContinueStmt";
|
||||||
|
case CXCursor_BreakStmt:
|
||||||
|
return "BreakStmt";
|
||||||
|
case CXCursor_ReturnStmt:
|
||||||
|
return "ReturnStmt";
|
||||||
|
case CXCursor_GCCAsmStmt:
|
||||||
|
return "GCCAsmStmt";
|
||||||
|
// case CXCursor_AsmStmt: return "AsmStmt";
|
||||||
|
case CXCursor_ObjCAtTryStmt:
|
||||||
|
return "ObjCAtTryStmt";
|
||||||
|
case CXCursor_ObjCAtCatchStmt:
|
||||||
|
return "ObjCAtCatchStmt";
|
||||||
|
case CXCursor_ObjCAtFinallyStmt:
|
||||||
|
return "ObjCAtFinallyStmt";
|
||||||
|
case CXCursor_ObjCAtThrowStmt:
|
||||||
|
return "ObjCAtThrowStmt";
|
||||||
|
case CXCursor_ObjCAtSynchronizedStmt:
|
||||||
|
return "ObjCAtSynchronizedStmt";
|
||||||
|
case CXCursor_ObjCAutoreleasePoolStmt:
|
||||||
|
return "ObjCAutoreleasePoolStmt";
|
||||||
|
case CXCursor_ObjCForCollectionStmt:
|
||||||
|
return "ObjCForCollectionStmt";
|
||||||
|
case CXCursor_CXXCatchStmt:
|
||||||
|
return "CXXCatchStmt";
|
||||||
|
case CXCursor_CXXTryStmt:
|
||||||
|
return "CXXTryStmt";
|
||||||
|
case CXCursor_CXXForRangeStmt:
|
||||||
|
return "CXXForRangeStmt";
|
||||||
|
case CXCursor_SEHTryStmt:
|
||||||
|
return "SEHTryStmt";
|
||||||
|
case CXCursor_SEHExceptStmt:
|
||||||
|
return "SEHExceptStmt";
|
||||||
|
case CXCursor_SEHFinallyStmt:
|
||||||
|
return "SEHFinallyStmt";
|
||||||
|
case CXCursor_MSAsmStmt:
|
||||||
|
return "MSAsmStmt";
|
||||||
|
case CXCursor_NullStmt:
|
||||||
|
return "NullStmt";
|
||||||
|
case CXCursor_DeclStmt:
|
||||||
|
return "DeclStmt";
|
||||||
|
case CXCursor_LastStmt:
|
||||||
|
return "LastStmt";
|
||||||
|
case CXCursor_TranslationUnit:
|
||||||
|
return "TranslationUnit";
|
||||||
|
// case CXCursor_FirstAttr: return "FirstAttr";
|
||||||
|
case CXCursor_UnexposedAttr:
|
||||||
|
return "UnexposedAttr";
|
||||||
|
case CXCursor_IBActionAttr:
|
||||||
|
return "IBActionAttr";
|
||||||
|
case CXCursor_IBOutletAttr:
|
||||||
|
return "IBOutletAttr";
|
||||||
|
case CXCursor_IBOutletCollectionAttr:
|
||||||
|
return "IBOutletCollectionAttr";
|
||||||
|
case CXCursor_CXXFinalAttr:
|
||||||
|
return "CXXFinalAttr";
|
||||||
|
case CXCursor_CXXOverrideAttr:
|
||||||
|
return "CXXOverrideAttr";
|
||||||
|
case CXCursor_AnnotateAttr:
|
||||||
|
return "AnnotateAttr";
|
||||||
|
case CXCursor_AsmLabelAttr:
|
||||||
|
return "AsmLabelAttr";
|
||||||
|
case CXCursor_LastAttr:
|
||||||
|
return "LastAttr";
|
||||||
|
case CXCursor_PreprocessingDirective:
|
||||||
|
return "PreprocessingDirective";
|
||||||
|
case CXCursor_MacroDefinition:
|
||||||
|
return "MacroDefinition";
|
||||||
|
case CXCursor_MacroExpansion:
|
||||||
|
return "MacroExpansion";
|
||||||
|
// case CXCursor_MacroInstantiation: return "MacroInstantiation";
|
||||||
|
case CXCursor_InclusionDirective:
|
||||||
|
return "InclusionDirective";
|
||||||
|
// case CXCursor_FirstPreprocessing: return "FirstPreprocessing";
|
||||||
|
// case CXCursor_LastPreprocessing: return "LastPreprocessing";
|
||||||
|
case CXCursor_ModuleImportDecl:
|
||||||
|
return "ModuleImportDecl";
|
||||||
|
// case CXCursor_FirstExtraDecl: return "FirstExtraDecl";
|
||||||
|
case CXCursor_LastExtraDecl:
|
||||||
|
return "LastExtraDecl";
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return "<unknown kind>";
|
||||||
|
}
|
||||||
|
@ -14,3 +14,7 @@ optional<lsDiagnostic> BuildAndDisposeDiagnostic(CXDiagnostic diagnostic,
|
|||||||
|
|
||||||
// Returns the absolute path to |file|.
|
// Returns the absolute path to |file|.
|
||||||
std::string FileName(CXFile file);
|
std::string FileName(CXFile file);
|
||||||
|
|
||||||
|
std::string ToString(CXString cx_string);
|
||||||
|
|
||||||
|
std::string ToString(CXCursorKind cursor_kind);
|
@ -24,9 +24,9 @@
|
|||||||
#include "working_files.h"
|
#include "working_files.h"
|
||||||
|
|
||||||
#include <doctest/doctest.h>
|
#include <doctest/doctest.h>
|
||||||
#include <loguru.hpp>
|
|
||||||
#include <rapidjson/istreamwrapper.h>
|
#include <rapidjson/istreamwrapper.h>
|
||||||
#include <rapidjson/ostreamwrapper.h>
|
#include <rapidjson/ostreamwrapper.h>
|
||||||
|
#include <loguru.hpp>
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -85,7 +85,7 @@ std::vector<std::unique_ptr<IndexFile>> FileConsumer::TakeLocalState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileConsumer::EmitError(CXFile file) const {
|
void FileConsumer::EmitError(CXFile file) const {
|
||||||
std::string file_name = clang::ToString(clang_getFileName(file));
|
std::string file_name = ToString(clang_getFileName(file));
|
||||||
// TODO: Investigate this more, why can we get an empty file name?
|
// TODO: Investigate this more, why can we get an empty file name?
|
||||||
if (!file_name.empty()) {
|
if (!file_name.empty()) {
|
||||||
std::string error_message = "Could not get unique file id for " +
|
std::string error_message = "Could not get unique file id for " +
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "libclangmm/Cursor.h"
|
#include "libclangmm/Cursor.h"
|
||||||
#include "libclangmm/Index.h"
|
#include "libclangmm/Index.h"
|
||||||
#include "libclangmm/TranslationUnit.h"
|
#include "libclangmm/TranslationUnit.h"
|
||||||
#include "libclangmm/Utility.h"
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "serializer.h"
|
#include "serializer.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
@ -446,8 +445,8 @@ clang::VisiterResult DumpVisitor(clang::Cursor cursor,
|
|||||||
int* level) {
|
int* level) {
|
||||||
for (int i = 0; i < *level; ++i)
|
for (int i = 0; i < *level; ++i)
|
||||||
std::cerr << " ";
|
std::cerr << " ";
|
||||||
std::cerr << clang::ToString(cursor.get_kind()) << " "
|
std::cerr << ToString(cursor.get_kind()) << " " << cursor.get_spelling()
|
||||||
<< cursor.get_spelling() << std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
*level += 1;
|
*level += 1;
|
||||||
cursor.VisitChildren(&DumpVisitor, level);
|
cursor.VisitChildren(&DumpVisitor, level);
|
||||||
@ -923,8 +922,8 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
|||||||
// if (!decl->isRedeclaration) {
|
// if (!decl->isRedeclaration) {
|
||||||
var->def.short_name = decl->entityInfo->name;
|
var->def.short_name = decl->entityInfo->name;
|
||||||
|
|
||||||
std::string type_name = clang::ToString(
|
std::string type_name =
|
||||||
clang_getTypeSpelling(clang_getCursorType(decl->cursor)));
|
ToString(clang_getTypeSpelling(clang_getCursorType(decl->cursor)));
|
||||||
var->def.detailed_name =
|
var->def.detailed_name =
|
||||||
type_name + " " +
|
type_name + " " +
|
||||||
ns->QualifiedName(decl->semanticContainer, var->def.short_name);
|
ns->QualifiedName(decl->semanticContainer, var->def.short_name);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "clang_utils.h"
|
||||||
#include "file_consumer.h"
|
#include "file_consumer.h"
|
||||||
#include "language_server_api.h"
|
#include "language_server_api.h"
|
||||||
#include "libclangmm/Index.h"
|
#include "libclangmm/Index.h"
|
||||||
#include "libclangmm/TranslationUnit.h"
|
#include "libclangmm/TranslationUnit.h"
|
||||||
#include "libclangmm/Utility.h"
|
|
||||||
#include "performance.h"
|
#include "performance.h"
|
||||||
#include "position.h"
|
#include "position.h"
|
||||||
#include "serializer.h"
|
#include "serializer.h"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "../clang_utils.h"
|
||||||
#include "Cursor.h"
|
#include "Cursor.h"
|
||||||
#include "Utility.h"
|
|
||||||
|
|
||||||
namespace clang {
|
namespace clang {
|
||||||
|
|
||||||
@ -141,15 +141,15 @@ SourceRange Cursor::get_source_range() const {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
std::string Cursor::get_spelling() const {
|
std::string Cursor::get_spelling() const {
|
||||||
return clang::ToString(clang_getCursorSpelling(cx_cursor));
|
return ::ToString(clang_getCursorSpelling(cx_cursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Cursor::get_display_name() const {
|
std::string Cursor::get_display_name() const {
|
||||||
return clang::ToString(clang_getCursorDisplayName(cx_cursor));
|
return ::ToString(clang_getCursorDisplayName(cx_cursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Cursor::get_usr() const {
|
std::string Cursor::get_usr() const {
|
||||||
return clang::ToString(clang_getCursorUSR(cx_cursor));
|
return ::ToString(clang_getCursorUSR(cx_cursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Cursor::is_definition() const {
|
bool Cursor::is_definition() const {
|
||||||
@ -203,7 +203,7 @@ bool Cursor::is_valid_kind() const {
|
|||||||
|
|
||||||
std::string Cursor::get_type_description() const {
|
std::string Cursor::get_type_description() const {
|
||||||
auto type = clang_getCursorType(cx_cursor);
|
auto type = clang_getCursorType(cx_cursor);
|
||||||
return clang::ToString(clang_getTypeSpelling(type));
|
return ::ToString(clang_getTypeSpelling(type));
|
||||||
|
|
||||||
#if false
|
#if false
|
||||||
std::string spelling;
|
std::string spelling;
|
||||||
@ -338,14 +338,13 @@ std::string Cursor::evaluate() const {
|
|||||||
std::string Cursor::get_comments() const {
|
std::string Cursor::get_comments() const {
|
||||||
Cursor referenced = get_referenced();
|
Cursor referenced = get_referenced();
|
||||||
if (referenced)
|
if (referenced)
|
||||||
return clang::ToString(
|
return ::ToString(clang_Cursor_getRawCommentText(referenced.cx_cursor));
|
||||||
clang_Cursor_getRawCommentText(referenced.cx_cursor));
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Cursor::ToString() const {
|
std::string Cursor::ToString() const {
|
||||||
return clang::ToString(get_kind()) + " " + get_spelling();
|
return ::ToString(get_kind()) + " " + get_spelling();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace clang
|
} // namespace clang
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "../platform.h"
|
#include "../platform.h"
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
#include "Utility.h"
|
|
||||||
|
|
||||||
#include <loguru.hpp>
|
#include <loguru.hpp>
|
||||||
|
|
||||||
|
@ -1,333 +0,0 @@
|
|||||||
#include "Utility.h"
|
|
||||||
|
|
||||||
std::string clang::ToString(CXString cx_string) {
|
|
||||||
std::string string;
|
|
||||||
if (cx_string.data != nullptr) {
|
|
||||||
string = clang_getCString(cx_string);
|
|
||||||
clang_disposeString(cx_string);
|
|
||||||
}
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string clang::ToString(CXCursorKind kind) {
|
|
||||||
switch (kind) {
|
|
||||||
case CXCursor_UnexposedDecl:
|
|
||||||
return "UnexposedDecl";
|
|
||||||
case CXCursor_StructDecl:
|
|
||||||
return "StructDecl";
|
|
||||||
case CXCursor_UnionDecl:
|
|
||||||
return "UnionDecl";
|
|
||||||
case CXCursor_ClassDecl:
|
|
||||||
return "ClassDecl";
|
|
||||||
case CXCursor_EnumDecl:
|
|
||||||
return "EnumDecl";
|
|
||||||
case CXCursor_FieldDecl:
|
|
||||||
return "FieldDecl";
|
|
||||||
case CXCursor_EnumConstantDecl:
|
|
||||||
return "EnumConstantDecl";
|
|
||||||
case CXCursor_FunctionDecl:
|
|
||||||
return "FunctionDecl";
|
|
||||||
case CXCursor_VarDecl:
|
|
||||||
return "VarDecl";
|
|
||||||
case CXCursor_ParmDecl:
|
|
||||||
return "ParmDecl";
|
|
||||||
case CXCursor_ObjCInterfaceDecl:
|
|
||||||
return "ObjCInterfaceDecl";
|
|
||||||
case CXCursor_ObjCCategoryDecl:
|
|
||||||
return "ObjCCategoryDecl";
|
|
||||||
case CXCursor_ObjCProtocolDecl:
|
|
||||||
return "ObjCProtocolDecl";
|
|
||||||
case CXCursor_ObjCPropertyDecl:
|
|
||||||
return "ObjCPropertyDecl";
|
|
||||||
case CXCursor_ObjCIvarDecl:
|
|
||||||
return "ObjCIvarDecl";
|
|
||||||
case CXCursor_ObjCInstanceMethodDecl:
|
|
||||||
return "ObjCInstanceMethodDecl";
|
|
||||||
case CXCursor_ObjCClassMethodDecl:
|
|
||||||
return "ObjCClassMethodDecl";
|
|
||||||
case CXCursor_ObjCImplementationDecl:
|
|
||||||
return "ObjCImplementationDecl";
|
|
||||||
case CXCursor_ObjCCategoryImplDecl:
|
|
||||||
return "ObjCCategoryImplDecl";
|
|
||||||
case CXCursor_TypedefDecl:
|
|
||||||
return "TypedefDecl";
|
|
||||||
case CXCursor_CXXMethod:
|
|
||||||
return "CXXMethod";
|
|
||||||
case CXCursor_Namespace:
|
|
||||||
return "Namespace";
|
|
||||||
case CXCursor_LinkageSpec:
|
|
||||||
return "LinkageSpec";
|
|
||||||
case CXCursor_Constructor:
|
|
||||||
return "Constructor";
|
|
||||||
case CXCursor_Destructor:
|
|
||||||
return "Destructor";
|
|
||||||
case CXCursor_ConversionFunction:
|
|
||||||
return "ConversionFunction";
|
|
||||||
case CXCursor_TemplateTypeParameter:
|
|
||||||
return "TemplateTypeParameter";
|
|
||||||
case CXCursor_NonTypeTemplateParameter:
|
|
||||||
return "NonTypeTemplateParameter";
|
|
||||||
case CXCursor_TemplateTemplateParameter:
|
|
||||||
return "TemplateTemplateParameter";
|
|
||||||
case CXCursor_FunctionTemplate:
|
|
||||||
return "FunctionTemplate";
|
|
||||||
case CXCursor_ClassTemplate:
|
|
||||||
return "ClassTemplate";
|
|
||||||
case CXCursor_ClassTemplatePartialSpecialization:
|
|
||||||
return "ClassTemplatePartialSpecialization";
|
|
||||||
case CXCursor_NamespaceAlias:
|
|
||||||
return "NamespaceAlias";
|
|
||||||
case CXCursor_UsingDirective:
|
|
||||||
return "UsingDirective";
|
|
||||||
case CXCursor_UsingDeclaration:
|
|
||||||
return "UsingDeclaration";
|
|
||||||
case CXCursor_TypeAliasDecl:
|
|
||||||
return "TypeAliasDecl";
|
|
||||||
case CXCursor_ObjCSynthesizeDecl:
|
|
||||||
return "ObjCSynthesizeDecl";
|
|
||||||
case CXCursor_ObjCDynamicDecl:
|
|
||||||
return "ObjCDynamicDecl";
|
|
||||||
case CXCursor_CXXAccessSpecifier:
|
|
||||||
return "CXXAccessSpecifier";
|
|
||||||
// case CXCursor_FirstDecl: return "FirstDecl";
|
|
||||||
// case CXCursor_LastDecl: return "LastDecl";
|
|
||||||
// case CXCursor_FirstRef: return "FirstRef";
|
|
||||||
case CXCursor_ObjCSuperClassRef:
|
|
||||||
return "ObjCSuperClassRef";
|
|
||||||
case CXCursor_ObjCProtocolRef:
|
|
||||||
return "ObjCProtocolRef";
|
|
||||||
case CXCursor_ObjCClassRef:
|
|
||||||
return "ObjCClassRef";
|
|
||||||
case CXCursor_TypeRef:
|
|
||||||
return "TypeRef";
|
|
||||||
case CXCursor_CXXBaseSpecifier:
|
|
||||||
return "CXXBaseSpecifier";
|
|
||||||
case CXCursor_TemplateRef:
|
|
||||||
return "TemplateRef";
|
|
||||||
case CXCursor_NamespaceRef:
|
|
||||||
return "NamespaceRef";
|
|
||||||
case CXCursor_MemberRef:
|
|
||||||
return "MemberRef";
|
|
||||||
case CXCursor_LabelRef:
|
|
||||||
return "LabelRef";
|
|
||||||
case CXCursor_OverloadedDeclRef:
|
|
||||||
return "OverloadedDeclRef";
|
|
||||||
case CXCursor_VariableRef:
|
|
||||||
return "VariableRef";
|
|
||||||
// case CXCursor_LastRef: return "LastRef";
|
|
||||||
// case CXCursor_FirstInvalid: return "FirstInvalid";
|
|
||||||
case CXCursor_InvalidFile:
|
|
||||||
return "InvalidFile";
|
|
||||||
case CXCursor_NoDeclFound:
|
|
||||||
return "NoDeclFound";
|
|
||||||
case CXCursor_NotImplemented:
|
|
||||||
return "NotImplemented";
|
|
||||||
case CXCursor_InvalidCode:
|
|
||||||
return "InvalidCode";
|
|
||||||
// case CXCursor_LastInvalid: return "LastInvalid";
|
|
||||||
// case CXCursor_FirstExpr: return "FirstExpr";
|
|
||||||
case CXCursor_UnexposedExpr:
|
|
||||||
return "UnexposedExpr";
|
|
||||||
case CXCursor_DeclRefExpr:
|
|
||||||
return "DeclRefExpr";
|
|
||||||
case CXCursor_MemberRefExpr:
|
|
||||||
return "MemberRefExpr";
|
|
||||||
case CXCursor_CallExpr:
|
|
||||||
return "CallExpr";
|
|
||||||
case CXCursor_ObjCMessageExpr:
|
|
||||||
return "ObjCMessageExpr";
|
|
||||||
case CXCursor_BlockExpr:
|
|
||||||
return "BlockExpr";
|
|
||||||
case CXCursor_IntegerLiteral:
|
|
||||||
return "IntegerLiteral";
|
|
||||||
case CXCursor_FloatingLiteral:
|
|
||||||
return "FloatingLiteral";
|
|
||||||
case CXCursor_ImaginaryLiteral:
|
|
||||||
return "ImaginaryLiteral";
|
|
||||||
case CXCursor_StringLiteral:
|
|
||||||
return "StringLiteral";
|
|
||||||
case CXCursor_CharacterLiteral:
|
|
||||||
return "CharacterLiteral";
|
|
||||||
case CXCursor_ParenExpr:
|
|
||||||
return "ParenExpr";
|
|
||||||
case CXCursor_UnaryOperator:
|
|
||||||
return "UnaryOperator";
|
|
||||||
case CXCursor_ArraySubscriptExpr:
|
|
||||||
return "ArraySubscriptExpr";
|
|
||||||
case CXCursor_BinaryOperator:
|
|
||||||
return "BinaryOperator";
|
|
||||||
case CXCursor_CompoundAssignOperator:
|
|
||||||
return "CompoundAssignOperator";
|
|
||||||
case CXCursor_ConditionalOperator:
|
|
||||||
return "ConditionalOperator";
|
|
||||||
case CXCursor_CStyleCastExpr:
|
|
||||||
return "CStyleCastExpr";
|
|
||||||
case CXCursor_CompoundLiteralExpr:
|
|
||||||
return "CompoundLiteralExpr";
|
|
||||||
case CXCursor_InitListExpr:
|
|
||||||
return "InitListExpr";
|
|
||||||
case CXCursor_AddrLabelExpr:
|
|
||||||
return "AddrLabelExpr";
|
|
||||||
case CXCursor_StmtExpr:
|
|
||||||
return "StmtExpr";
|
|
||||||
case CXCursor_GenericSelectionExpr:
|
|
||||||
return "GenericSelectionExpr";
|
|
||||||
case CXCursor_GNUNullExpr:
|
|
||||||
return "GNUNullExpr";
|
|
||||||
case CXCursor_CXXStaticCastExpr:
|
|
||||||
return "CXXStaticCastExpr";
|
|
||||||
case CXCursor_CXXDynamicCastExpr:
|
|
||||||
return "CXXDynamicCastExpr";
|
|
||||||
case CXCursor_CXXReinterpretCastExpr:
|
|
||||||
return "CXXReinterpretCastExpr";
|
|
||||||
case CXCursor_CXXConstCastExpr:
|
|
||||||
return "CXXConstCastExpr";
|
|
||||||
case CXCursor_CXXFunctionalCastExpr:
|
|
||||||
return "CXXFunctionalCastExpr";
|
|
||||||
case CXCursor_CXXTypeidExpr:
|
|
||||||
return "CXXTypeidExpr";
|
|
||||||
case CXCursor_CXXBoolLiteralExpr:
|
|
||||||
return "CXXBoolLiteralExpr";
|
|
||||||
case CXCursor_CXXNullPtrLiteralExpr:
|
|
||||||
return "CXXNullPtrLiteralExpr";
|
|
||||||
case CXCursor_CXXThisExpr:
|
|
||||||
return "CXXThisExpr";
|
|
||||||
case CXCursor_CXXThrowExpr:
|
|
||||||
return "CXXThrowExpr";
|
|
||||||
case CXCursor_CXXNewExpr:
|
|
||||||
return "CXXNewExpr";
|
|
||||||
case CXCursor_CXXDeleteExpr:
|
|
||||||
return "CXXDeleteExpr";
|
|
||||||
case CXCursor_UnaryExpr:
|
|
||||||
return "UnaryExpr";
|
|
||||||
case CXCursor_ObjCStringLiteral:
|
|
||||||
return "ObjCStringLiteral";
|
|
||||||
case CXCursor_ObjCEncodeExpr:
|
|
||||||
return "ObjCEncodeExpr";
|
|
||||||
case CXCursor_ObjCSelectorExpr:
|
|
||||||
return "ObjCSelectorExpr";
|
|
||||||
case CXCursor_ObjCProtocolExpr:
|
|
||||||
return "ObjCProtocolExpr";
|
|
||||||
case CXCursor_ObjCBridgedCastExpr:
|
|
||||||
return "ObjCBridgedCastExpr";
|
|
||||||
case CXCursor_PackExpansionExpr:
|
|
||||||
return "PackExpansionExpr";
|
|
||||||
case CXCursor_SizeOfPackExpr:
|
|
||||||
return "SizeOfPackExpr";
|
|
||||||
case CXCursor_LambdaExpr:
|
|
||||||
return "LambdaExpr";
|
|
||||||
case CXCursor_ObjCBoolLiteralExpr:
|
|
||||||
return "ObjCBoolLiteralExpr";
|
|
||||||
case CXCursor_ObjCSelfExpr:
|
|
||||||
return "ObjCSelfExpr";
|
|
||||||
// case CXCursor_LastExpr: return "LastExpr";
|
|
||||||
// case CXCursor_FirstStmt: return "FirstStmt";
|
|
||||||
case CXCursor_UnexposedStmt:
|
|
||||||
return "UnexposedStmt";
|
|
||||||
case CXCursor_LabelStmt:
|
|
||||||
return "LabelStmt";
|
|
||||||
case CXCursor_CompoundStmt:
|
|
||||||
return "CompoundStmt";
|
|
||||||
case CXCursor_CaseStmt:
|
|
||||||
return "CaseStmt";
|
|
||||||
case CXCursor_DefaultStmt:
|
|
||||||
return "DefaultStmt";
|
|
||||||
case CXCursor_IfStmt:
|
|
||||||
return "IfStmt";
|
|
||||||
case CXCursor_SwitchStmt:
|
|
||||||
return "SwitchStmt";
|
|
||||||
case CXCursor_WhileStmt:
|
|
||||||
return "WhileStmt";
|
|
||||||
case CXCursor_DoStmt:
|
|
||||||
return "DoStmt";
|
|
||||||
case CXCursor_ForStmt:
|
|
||||||
return "ForStmt";
|
|
||||||
case CXCursor_GotoStmt:
|
|
||||||
return "GotoStmt";
|
|
||||||
case CXCursor_IndirectGotoStmt:
|
|
||||||
return "IndirectGotoStmt";
|
|
||||||
case CXCursor_ContinueStmt:
|
|
||||||
return "ContinueStmt";
|
|
||||||
case CXCursor_BreakStmt:
|
|
||||||
return "BreakStmt";
|
|
||||||
case CXCursor_ReturnStmt:
|
|
||||||
return "ReturnStmt";
|
|
||||||
case CXCursor_GCCAsmStmt:
|
|
||||||
return "GCCAsmStmt";
|
|
||||||
// case CXCursor_AsmStmt: return "AsmStmt";
|
|
||||||
case CXCursor_ObjCAtTryStmt:
|
|
||||||
return "ObjCAtTryStmt";
|
|
||||||
case CXCursor_ObjCAtCatchStmt:
|
|
||||||
return "ObjCAtCatchStmt";
|
|
||||||
case CXCursor_ObjCAtFinallyStmt:
|
|
||||||
return "ObjCAtFinallyStmt";
|
|
||||||
case CXCursor_ObjCAtThrowStmt:
|
|
||||||
return "ObjCAtThrowStmt";
|
|
||||||
case CXCursor_ObjCAtSynchronizedStmt:
|
|
||||||
return "ObjCAtSynchronizedStmt";
|
|
||||||
case CXCursor_ObjCAutoreleasePoolStmt:
|
|
||||||
return "ObjCAutoreleasePoolStmt";
|
|
||||||
case CXCursor_ObjCForCollectionStmt:
|
|
||||||
return "ObjCForCollectionStmt";
|
|
||||||
case CXCursor_CXXCatchStmt:
|
|
||||||
return "CXXCatchStmt";
|
|
||||||
case CXCursor_CXXTryStmt:
|
|
||||||
return "CXXTryStmt";
|
|
||||||
case CXCursor_CXXForRangeStmt:
|
|
||||||
return "CXXForRangeStmt";
|
|
||||||
case CXCursor_SEHTryStmt:
|
|
||||||
return "SEHTryStmt";
|
|
||||||
case CXCursor_SEHExceptStmt:
|
|
||||||
return "SEHExceptStmt";
|
|
||||||
case CXCursor_SEHFinallyStmt:
|
|
||||||
return "SEHFinallyStmt";
|
|
||||||
case CXCursor_MSAsmStmt:
|
|
||||||
return "MSAsmStmt";
|
|
||||||
case CXCursor_NullStmt:
|
|
||||||
return "NullStmt";
|
|
||||||
case CXCursor_DeclStmt:
|
|
||||||
return "DeclStmt";
|
|
||||||
case CXCursor_LastStmt:
|
|
||||||
return "LastStmt";
|
|
||||||
case CXCursor_TranslationUnit:
|
|
||||||
return "TranslationUnit";
|
|
||||||
// case CXCursor_FirstAttr: return "FirstAttr";
|
|
||||||
case CXCursor_UnexposedAttr:
|
|
||||||
return "UnexposedAttr";
|
|
||||||
case CXCursor_IBActionAttr:
|
|
||||||
return "IBActionAttr";
|
|
||||||
case CXCursor_IBOutletAttr:
|
|
||||||
return "IBOutletAttr";
|
|
||||||
case CXCursor_IBOutletCollectionAttr:
|
|
||||||
return "IBOutletCollectionAttr";
|
|
||||||
case CXCursor_CXXFinalAttr:
|
|
||||||
return "CXXFinalAttr";
|
|
||||||
case CXCursor_CXXOverrideAttr:
|
|
||||||
return "CXXOverrideAttr";
|
|
||||||
case CXCursor_AnnotateAttr:
|
|
||||||
return "AnnotateAttr";
|
|
||||||
case CXCursor_AsmLabelAttr:
|
|
||||||
return "AsmLabelAttr";
|
|
||||||
case CXCursor_LastAttr:
|
|
||||||
return "LastAttr";
|
|
||||||
case CXCursor_PreprocessingDirective:
|
|
||||||
return "PreprocessingDirective";
|
|
||||||
case CXCursor_MacroDefinition:
|
|
||||||
return "MacroDefinition";
|
|
||||||
case CXCursor_MacroExpansion:
|
|
||||||
return "MacroExpansion";
|
|
||||||
// case CXCursor_MacroInstantiation: return "MacroInstantiation";
|
|
||||||
case CXCursor_InclusionDirective:
|
|
||||||
return "InclusionDirective";
|
|
||||||
// case CXCursor_FirstPreprocessing: return "FirstPreprocessing";
|
|
||||||
// case CXCursor_LastPreprocessing: return "LastPreprocessing";
|
|
||||||
case CXCursor_ModuleImportDecl:
|
|
||||||
return "ModuleImportDecl";
|
|
||||||
// case CXCursor_FirstExtraDecl: return "FirstExtraDecl";
|
|
||||||
case CXCursor_LastExtraDecl:
|
|
||||||
return "LastExtraDecl";
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return "<unknown kind>";
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <clang-c/Index.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace clang {
|
|
||||||
|
|
||||||
std::string ToString(CXString cx_string);
|
|
||||||
std::string ToString(CXCursorKind cursor_kind);
|
|
||||||
|
|
||||||
} // namespace clang
|
|
@ -1,6 +1,6 @@
|
|||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
|
||||||
#include "libclangmm/Utility.h"
|
#include "clang_utils.h"
|
||||||
#include "match.h"
|
#include "match.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "serializer.h"
|
#include "serializer.h"
|
||||||
@ -259,16 +259,16 @@ std::vector<Project::Entry> LoadCompilationEntriesFromDirectory(
|
|||||||
clang_CompileCommands_getCommand(cx_commands, i);
|
clang_CompileCommands_getCommand(cx_commands, i);
|
||||||
|
|
||||||
std::string directory =
|
std::string directory =
|
||||||
clang::ToString(clang_CompileCommand_getDirectory(cx_command));
|
ToString(clang_CompileCommand_getDirectory(cx_command));
|
||||||
std::string relative_filename =
|
std::string relative_filename =
|
||||||
clang::ToString(clang_CompileCommand_getFilename(cx_command));
|
ToString(clang_CompileCommand_getFilename(cx_command));
|
||||||
|
|
||||||
unsigned num_args = clang_CompileCommand_getNumArgs(cx_command);
|
unsigned num_args = clang_CompileCommand_getNumArgs(cx_command);
|
||||||
CompileCommandsEntry entry;
|
CompileCommandsEntry entry;
|
||||||
entry.args.reserve(num_args);
|
entry.args.reserve(num_args);
|
||||||
for (unsigned j = 0; j < num_args; ++j)
|
for (unsigned j = 0; j < num_args; ++j)
|
||||||
entry.args.push_back(
|
entry.args.push_back(
|
||||||
clang::ToString(clang_CompileCommand_getArg(cx_command, j)));
|
ToString(clang_CompileCommand_getArg(cx_command, j)));
|
||||||
clang_time.Pause(); // TODO: don't call clang::ToString in this block.
|
clang_time.Pause(); // TODO: don't call clang::ToString in this block.
|
||||||
|
|
||||||
our_time.Resume();
|
our_time.Resume();
|
||||||
|
@ -429,9 +429,9 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
|||||||
bool did_add = \
|
bool did_add = \
|
||||||
ComputeDifferenceForUpdate(previous, current, &removed, &added); \
|
ComputeDifferenceForUpdate(previous, current, &removed, &added); \
|
||||||
if (did_add) { \
|
if (did_add) { \
|
||||||
/*std::cerr << "Adding mergeable update on " << \
|
/*std::cerr << "Adding mergeable update on " << \ \ \ \ \ \ \
|
||||||
* current_def->def.short_name << " (" << current_def->def.usr << ") for \
|
* current_def->def.short_name << " (" << current_def->def.usr << ") for \
|
||||||
* field " << #index_name << std::endl;*/ \
|
* \ \ \ \ \ \ field " << #index_name << std::endl;*/ \
|
||||||
query_name.push_back(MergeableUpdate<type_id, type>( \
|
query_name.push_back(MergeableUpdate<type_id, type>( \
|
||||||
current_id_map.ToQuery(current_def->id), added, removed)); \
|
current_id_map.ToQuery(current_def->id), added, removed)); \
|
||||||
} \
|
} \
|
||||||
@ -606,7 +606,7 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IndexUpdate::Merge(const IndexUpdate& update) {
|
void IndexUpdate::Merge(const IndexUpdate& update) {
|
||||||
// This function runs on an indexer thread.
|
// This function runs on an indexer thread.
|
||||||
|
|
||||||
#define INDEX_UPDATE_APPEND(name) AddRange(&name, update.name);
|
#define INDEX_UPDATE_APPEND(name) AddRange(&name, update.name);
|
||||||
#define INDEX_UPDATE_MERGE(name) AddMergeableRange(&name, update.name);
|
#define INDEX_UPDATE_MERGE(name) AddMergeableRange(&name, update.name);
|
||||||
|
Loading…
Reference in New Issue
Block a user