Some formatting changes

This commit is contained in:
Jacob Dufault 2017-04-22 00:42:57 -07:00
parent 489f54e538
commit 14aa4b77e4
9 changed files with 456 additions and 300 deletions

View File

@ -5,7 +5,6 @@
#include <memory>
#include <mutex>
// A object which can be stored and taken from atomically.
template <class T>
struct AtomicObject {
@ -21,7 +20,7 @@ struct AtomicObject {
// release lock as long as the wait and reaquire it afterwards.
cv_.wait(lock);
}
return std::move(value_);
}

View File

@ -8,7 +8,8 @@
namespace {
std::string GetCachedBaseFileName(const std::string& cache_directory, std::string source_file) {
std::string GetCachedBaseFileName(const std::string& cache_directory,
std::string source_file) {
assert(!cache_directory.empty());
std::replace(source_file.begin(), source_file.end(), '\\', '_');
std::replace(source_file.begin(), source_file.end(), '/', '_');
@ -19,11 +20,13 @@ std::string GetCachedBaseFileName(const std::string& cache_directory, std::strin
} // namespace
std::unique_ptr<IndexedFile> LoadCachedIndex(IndexerConfig* config, const std::string& filename) {
std::unique_ptr<IndexedFile> LoadCachedIndex(IndexerConfig* config,
const std::string& filename) {
if (!config->enableCacheRead)
return nullptr;
optional<std::string> file_content = ReadContent(GetCachedBaseFileName(config->cacheDirectory, filename) + ".json");
optional<std::string> file_content = ReadContent(
GetCachedBaseFileName(config->cacheDirectory, filename) + ".json");
if (!file_content)
return nullptr;
@ -34,18 +37,23 @@ std::unique_ptr<IndexedFile> LoadCachedIndex(IndexerConfig* config, const std::s
return nullptr;
}
optional<std::string> LoadCachedFileContents(IndexerConfig* config, const std::string& filename) {
optional<std::string> LoadCachedFileContents(IndexerConfig* config,
const std::string& filename) {
if (!config->enableCacheRead)
return nullopt;
return ReadContent(GetCachedBaseFileName(config->cacheDirectory, filename) + ".txt");
return ReadContent(GetCachedBaseFileName(config->cacheDirectory, filename) +
".txt");
}
void WriteToCache(IndexerConfig* config, const std::string& filename, IndexedFile& file) {
void WriteToCache(IndexerConfig* config,
const std::string& filename,
IndexedFile& file) {
if (!config->enableCacheWrite)
return;
std::string cache_basename = GetCachedBaseFileName(config->cacheDirectory, filename);
std::string cache_basename =
GetCachedBaseFileName(config->cacheDirectory, filename);
CopyFileTo(cache_basename + ".txt", filename);

View File

@ -10,8 +10,12 @@ using std::experimental::nullopt;
struct IndexerConfig;
struct IndexedFile;
std::unique_ptr<IndexedFile> LoadCachedIndex(IndexerConfig* config, const std::string& filename);
std::unique_ptr<IndexedFile> LoadCachedIndex(IndexerConfig* config,
const std::string& filename);
optional<std::string> LoadCachedFileContents(IndexerConfig* config, const std::string& filename);
optional<std::string> LoadCachedFileContents(IndexerConfig* config,
const std::string& filename);
void WriteToCache(IndexerConfig* config, const std::string& filename, IndexedFile& file);
void WriteToCache(IndexerConfig* config,
const std::string& filename,
IndexedFile& file);

View File

@ -10,15 +10,14 @@ Type::Type() : cx_type() {}
Type::Type(const CXType& other) : cx_type(other) {}
bool Type::operator==(const Type& rhs) const {
return clang_equalTypes(cx_type, rhs.cx_type);
}
bool Type::is_fundamental() const {
//switch (cx_type.kind) {
//case CXType_Auto:
//return true;
// switch (cx_type.kind) {
// case CXType_Auto:
// return true;
//}
// NOTE: This will return false for pointed types. Should we call
@ -36,11 +35,11 @@ std::string Type::get_usr() const {
}
Type Type::strip_qualifiers() const {
//CXRefQualifierKind qualifiers = clang_Type_getCXXRefQualifier(cx_type)
// CXRefQualifierKind qualifiers = clang_Type_getCXXRefQualifier(cx_type)
switch (cx_type.kind) {
case CXType_LValueReference:
case CXType_Pointer:
return clang_getPointeeType(cx_type);
case CXType_LValueReference:
case CXType_Pointer:
return clang_getPointeeType(cx_type);
}
return cx_type;
@ -72,11 +71,11 @@ std::vector<Type> Type::get_arguments() const {
return types;
}
std::vector<Type> Type::get_template_arguments() const {
/*
CINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T);
CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T, unsigned i);
CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T, unsigned
i);
*/
int size = clang_Type_getNumTemplateArguments(cx_type);
@ -90,9 +89,8 @@ std::vector<Type> Type::get_template_arguments() const {
return types;
}
static_assert(sizeof(Cursor) == sizeof(CXCursor),
"Cursor must be the same size as CXCursor");
"Cursor must be the same size as CXCursor");
Cursor::Cursor() : cx_cursor(clang_getNullCursor()) {}
@ -182,15 +180,13 @@ bool Cursor::is_valid_kind() const {
CXCursorKind kind = get_kind();
return kind > CXCursor_UnexposedDecl &&
(kind < CXCursor_FirstInvalid || kind > CXCursor_LastInvalid);
(kind < CXCursor_FirstInvalid || kind > CXCursor_LastInvalid);
}
std::string Cursor::get_type_description() const {
auto type = clang_getCursorType(cx_cursor);
return clang::ToString(clang_getTypeSpelling(type));
std::string spelling;
auto referenced = clang_getCursorReferenced(cx_cursor);
@ -198,28 +194,35 @@ std::string Cursor::get_type_description() const {
auto type = clang_getCursorType(referenced);
spelling = clang::ToString(clang_getTypeSpelling(type));
#if CINDEX_VERSION_MAJOR==0 && CINDEX_VERSION_MINOR<32
#if CINDEX_VERSION_MAJOR == 0 && CINDEX_VERSION_MINOR < 32
const std::string auto_str = "auto";
if (spelling.size() >= 4 && std::equal(auto_str.begin(), auto_str.end(), spelling.begin())) {
auto canonical_type = clang_getCanonicalType(clang_getCursorType(cx_cursor));
if (spelling.size() >= 4 &&
std::equal(auto_str.begin(), auto_str.end(), spelling.begin())) {
auto canonical_type =
clang_getCanonicalType(clang_getCursorType(cx_cursor));
auto canonical_spelling = ToString(clang_getTypeSpelling(canonical_type));
if (spelling.size() > 5 && spelling[4] == ' ' && spelling[5] == '&' && spelling != canonical_spelling)
if (spelling.size() > 5 && spelling[4] == ' ' && spelling[5] == '&' &&
spelling != canonical_spelling)
return canonical_spelling + " &";
else
return canonical_spelling;
}
const std::string const_auto_str = "const auto";
if (spelling.size() >= 10 && std::equal(const_auto_str.begin(), const_auto_str.end(), spelling.begin())) {
auto canonical_type = clang_getCanonicalType(clang_getCursorType(cx_cursor));
if (spelling.size() >= 10 &&
std::equal(const_auto_str.begin(), const_auto_str.end(),
spelling.begin())) {
auto canonical_type =
clang_getCanonicalType(clang_getCursorType(cx_cursor));
auto canonical_spelling = ToString(clang_getTypeSpelling(canonical_type));
if (spelling.size() > 11 && spelling[10] == ' ' && spelling[11] == '&' && spelling != canonical_spelling)
if (spelling.size() > 11 && spelling[10] == ' ' && spelling[11] == '&' &&
spelling != canonical_spelling)
return canonical_spelling + " &";
else
return canonical_spelling;
}
}
#endif
}
}
if (spelling.empty())
return get_spelling();
@ -315,7 +318,8 @@ std::string Cursor::evaluate() const {
std::string Cursor::get_comments() const {
Cursor referenced = get_referenced();
if (referenced)
return clang::ToString(clang_Cursor_getRawCommentText(referenced.cx_cursor));
return clang::ToString(
clang_Cursor_getRawCommentText(referenced.cx_cursor));
return "";
}
@ -324,4 +328,4 @@ std::string Cursor::ToString() const {
return clang::ToString(get_kind()) + " " + get_spelling();
}
} // namespace clang
} // namespace clang

View File

@ -7,11 +7,10 @@
#include <clang-c/Index.h>
namespace clang {
class Type {
public:
public:
Type();
Type(const CXType& other);
@ -35,14 +34,10 @@ public:
CXType cx_type;
};
enum class VisiterResult {
Break,
Continue,
Recurse
};
enum class VisiterResult { Break, Continue, Recurse };
class Cursor {
public:
public:
Cursor();
Cursor(const CXCursor& other);
@ -52,8 +47,6 @@ public:
CXCursorKind get_kind() const;
Type get_type() const;
//SourceLocation get_source_location() const;
//SourceRange get_source_range() const;
std::string get_spelling() const;
std::string get_display_name() const;
std::string get_usr() const;
@ -75,23 +68,24 @@ public:
std::vector<Cursor> get_arguments() const;
bool is_valid_kind() const;
//std::string evaluate() const;
std::string get_type_description() const;
std::string get_comments() const;
std::string ToString() const;
template<typename TClientData>
using Visitor = VisiterResult(*)(Cursor cursor, Cursor parent, TClientData* client_data);
template <typename TClientData>
using Visitor = VisiterResult (*)(Cursor cursor,
Cursor parent,
TClientData* client_data);
enum class VisitResult {
Completed, EndedEarly
};
enum class VisitResult { Completed, EndedEarly };
template<typename TClientData>
VisitResult VisitChildren(Visitor<TClientData> visitor, TClientData* client_data) const {
if (clang_visitChildren(cx_cursor, reinterpret_cast<CXCursorVisitor>(visitor), client_data) == 0)
template <typename TClientData>
VisitResult VisitChildren(Visitor<TClientData> visitor,
TClientData* client_data) const {
if (clang_visitChildren(cx_cursor,
reinterpret_cast<CXCursorVisitor>(visitor),
client_data) == 0)
return VisitResult::Completed;
return VisitResult::EndedEarly;
}

View File

@ -3,11 +3,11 @@
#include <clang-c/Index.h>
namespace clang {
class Index {
public:
Index(int excludeDeclarationsFromPCH, int displayDiagnostics);
~Index();
CXIndex cx_index;
};
class Index {
public:
Index(int excludeDeclarationsFromPCH, int displayDiagnostics);
~Index();
CXIndex cx_index;
};
} // namespace clang
#endif // INDEX_H_

View File

@ -10,14 +10,12 @@
namespace clang {
TranslationUnit::TranslationUnit(
IndexerConfig* config,
Index &index,
const std::string& filepath,
const std::vector<std::string>& arguments,
std::vector<CXUnsavedFile> unsaved_files,
unsigned flags) {
TranslationUnit::TranslationUnit(IndexerConfig* config,
Index& index,
const std::string& filepath,
const std::vector<std::string>& arguments,
std::vector<CXUnsavedFile> unsaved_files,
unsigned flags) {
std::vector<const char*> args;
for (const std::string& a : arguments)
args.push_back(a.c_str());
@ -35,32 +33,30 @@ TranslationUnit::TranslationUnit(
std::cerr << std::endl;
CXErrorCode error_code = clang_parseTranslationUnit2(
index.cx_index,
filepath.c_str(),
args.data(), args.size(),
unsaved_files.data(), unsaved_files.size(),
flags, &cx_tu);
index.cx_index, filepath.c_str(), args.data(), args.size(),
unsaved_files.data(), unsaved_files.size(), flags, &cx_tu);
switch (error_code) {
case CXError_Success:
did_fail = false;
break;
case CXError_Failure:
std::cerr << "libclang generic failure for " << filepath << std::endl;
did_fail = true;
break;
case CXError_Crashed:
std::cerr << "libclang crashed for " << filepath << std::endl;
did_fail = true;
break;
case CXError_InvalidArguments:
std::cerr << "libclang had invalid arguments for " << filepath << std::endl;
did_fail = true;
break;
case CXError_ASTReadError:
std::cerr << "libclang had ast read error for " << filepath << std::endl;
did_fail = true;
break;
case CXError_Success:
did_fail = false;
break;
case CXError_Failure:
std::cerr << "libclang generic failure for " << filepath << std::endl;
did_fail = true;
break;
case CXError_Crashed:
std::cerr << "libclang crashed for " << filepath << std::endl;
did_fail = true;
break;
case CXError_InvalidArguments:
std::cerr << "libclang had invalid arguments for " << filepath
<< std::endl;
did_fail = true;
break;
case CXError_ASTReadError:
std::cerr << "libclang had ast read error for " << filepath << std::endl;
did_fail = true;
break;
}
}
@ -68,33 +64,35 @@ TranslationUnit::~TranslationUnit() {
clang_disposeTranslationUnit(cx_tu);
}
void TranslationUnit::ReparseTranslationUnit(std::vector<CXUnsavedFile>& unsaved) {
int error_code = clang_reparseTranslationUnit(cx_tu, unsaved.size(), unsaved.data(), clang_defaultReparseOptions(cx_tu));
void TranslationUnit::ReparseTranslationUnit(
std::vector<CXUnsavedFile>& unsaved) {
int error_code =
clang_reparseTranslationUnit(cx_tu, unsaved.size(), unsaved.data(),
clang_defaultReparseOptions(cx_tu));
switch (error_code) {
case CXError_Success:
did_fail = false;
break;
case CXError_Failure:
std::cerr << "libclang reparse generic failure" << std::endl;
did_fail = true;
break;
case CXError_Crashed:
std::cerr << "libclang reparse crashed " << std::endl;
did_fail = true;
break;
case CXError_InvalidArguments:
std::cerr << "libclang reparse had invalid arguments" << std::endl;
did_fail = true;
break;
case CXError_ASTReadError:
std::cerr << "libclang reparse had ast read error" << std::endl;
did_fail = true;
break;
case CXError_Success:
did_fail = false;
break;
case CXError_Failure:
std::cerr << "libclang reparse generic failure" << std::endl;
did_fail = true;
break;
case CXError_Crashed:
std::cerr << "libclang reparse crashed " << std::endl;
did_fail = true;
break;
case CXError_InvalidArguments:
std::cerr << "libclang reparse had invalid arguments" << std::endl;
did_fail = true;
break;
case CXError_ASTReadError:
std::cerr << "libclang reparse had ast read error" << std::endl;
did_fail = true;
break;
}
}
Cursor TranslationUnit::document_cursor() const {
return Cursor(clang_getTranslationUnitCursor(cx_tu));
}
}

View File

@ -10,24 +10,23 @@
#include "../language_server_api.h"
namespace clang {
class TranslationUnit {
public:
TranslationUnit(IndexerConfig* config,
Index &index,
const std::string &filepath,
const std::vector<std::string>& arguments,
std::vector<CXUnsavedFile> unsaved_files,
unsigned flags);
~TranslationUnit();
class TranslationUnit {
public:
TranslationUnit(IndexerConfig* config,
Index& index,
const std::string& filepath,
const std::vector<std::string>& arguments,
std::vector<CXUnsavedFile> unsaved_files,
unsigned flags);
~TranslationUnit();
bool did_fail = false;
bool did_fail = false;
void ReparseTranslationUnit(std::vector<CXUnsavedFile>& unsaved);
void ReparseTranslationUnit(std::vector<CXUnsavedFile>& unsaved);
Cursor document_cursor() const;
Cursor document_cursor() const;
CXTranslationUnit cx_tu;
};
CXTranslationUnit cx_tu;
};
} // namespace clang
#endif // TRANSLATIONUNIT_H_

View File

@ -2,8 +2,8 @@
std::string clang::ToString(CXString cx_string) {
std::string string;
if(cx_string.data!=nullptr) {
string=clang_getCString(cx_string);
if (cx_string.data != nullptr) {
string = clang_getCString(cx_string);
clang_disposeString(cx_string);
}
return string;
@ -11,171 +11,321 @@ std::string clang::ToString(CXString cx_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";
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";
}
return "<unknown kind>";
}