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 <memory>
#include <mutex> #include <mutex>
// A object which can be stored and taken from atomically. // A object which can be stored and taken from atomically.
template <class T> template <class T>
struct AtomicObject { struct AtomicObject {

View File

@ -8,7 +8,8 @@
namespace { 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()); assert(!cache_directory.empty());
std::replace(source_file.begin(), source_file.end(), '\\', '_'); std::replace(source_file.begin(), source_file.end(), '\\', '_');
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 } // 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) if (!config->enableCacheRead)
return nullptr; 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) if (!file_content)
return nullptr; return nullptr;
@ -34,18 +37,23 @@ std::unique_ptr<IndexedFile> LoadCachedIndex(IndexerConfig* config, const std::s
return nullptr; 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) if (!config->enableCacheRead)
return nullopt; 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) if (!config->enableCacheWrite)
return; return;
std::string cache_basename = GetCachedBaseFileName(config->cacheDirectory, filename); std::string cache_basename =
GetCachedBaseFileName(config->cacheDirectory, filename);
CopyFileTo(cache_basename + ".txt", filename); CopyFileTo(cache_basename + ".txt", filename);

View File

@ -10,8 +10,12 @@ using std::experimental::nullopt;
struct IndexerConfig; struct IndexerConfig;
struct IndexedFile; 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,7 +10,6 @@ Type::Type() : cx_type() {}
Type::Type(const CXType& other) : cx_type(other) {} Type::Type(const CXType& other) : cx_type(other) {}
bool Type::operator==(const Type& rhs) const { bool Type::operator==(const Type& rhs) const {
return clang_equalTypes(cx_type, rhs.cx_type); return clang_equalTypes(cx_type, rhs.cx_type);
} }
@ -72,11 +71,11 @@ std::vector<Type> Type::get_arguments() const {
return types; return types;
} }
std::vector<Type> Type::get_template_arguments() const { std::vector<Type> Type::get_template_arguments() const {
/* /*
CINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T); 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); int size = clang_Type_getNumTemplateArguments(cx_type);
@ -90,7 +89,6 @@ std::vector<Type> Type::get_template_arguments() const {
return types; return types;
} }
static_assert(sizeof(Cursor) == sizeof(CXCursor), static_assert(sizeof(Cursor) == sizeof(CXCursor),
"Cursor must be the same size as CXCursor"); "Cursor must be the same size as CXCursor");
@ -189,8 +187,6 @@ 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 clang::ToString(clang_getTypeSpelling(type));
std::string spelling; std::string spelling;
auto referenced = clang_getCursorReferenced(cx_cursor); auto referenced = clang_getCursorReferenced(cx_cursor);
@ -200,20 +196,27 @@ std::string Cursor::get_type_description() const {
#if CINDEX_VERSION_MAJOR == 0 && CINDEX_VERSION_MINOR < 32 #if CINDEX_VERSION_MAJOR == 0 && CINDEX_VERSION_MINOR < 32
const std::string auto_str = "auto"; const std::string auto_str = "auto";
if (spelling.size() >= 4 && std::equal(auto_str.begin(), auto_str.end(), spelling.begin())) { if (spelling.size() >= 4 &&
auto canonical_type = clang_getCanonicalType(clang_getCursorType(cx_cursor)); 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)); 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 + " &"; return canonical_spelling + " &";
else else
return canonical_spelling; return canonical_spelling;
} }
const std::string const_auto_str = "const auto"; const std::string const_auto_str = "const auto";
if (spelling.size() >= 10 && std::equal(const_auto_str.begin(), const_auto_str.end(), spelling.begin())) { if (spelling.size() >= 10 &&
auto canonical_type = clang_getCanonicalType(clang_getCursorType(cx_cursor)); 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)); 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 + " &"; return canonical_spelling + " &";
else else
return canonical_spelling; return canonical_spelling;
@ -315,7 +318,8 @@ 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(clang_Cursor_getRawCommentText(referenced.cx_cursor)); return clang::ToString(
clang_Cursor_getRawCommentText(referenced.cx_cursor));
return ""; return "";
} }

View File

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

View File

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

View File

@ -30,4 +30,3 @@ namespace clang {
}; };
} // namespace clang } // namespace clang
#endif // TRANSLATIONUNIT_H_ #endif // TRANSLATIONUNIT_H_

View File

@ -11,171 +11,321 @@ std::string clang::ToString(CXString cx_string) {
std::string clang::ToString(CXCursorKind kind) { std::string clang::ToString(CXCursorKind kind) {
switch (kind) { switch (kind) {
case CXCursor_UnexposedDecl: return "UnexposedDecl"; case CXCursor_UnexposedDecl:
case CXCursor_StructDecl: return "StructDecl"; return "UnexposedDecl";
case CXCursor_UnionDecl: return "UnionDecl"; case CXCursor_StructDecl:
case CXCursor_ClassDecl: return "ClassDecl"; return "StructDecl";
case CXCursor_EnumDecl: return "EnumDecl"; case CXCursor_UnionDecl:
case CXCursor_FieldDecl: return "FieldDecl"; return "UnionDecl";
case CXCursor_EnumConstantDecl: return "EnumConstantDecl"; case CXCursor_ClassDecl:
case CXCursor_FunctionDecl: return "FunctionDecl"; return "ClassDecl";
case CXCursor_VarDecl: return "VarDecl"; case CXCursor_EnumDecl:
case CXCursor_ParmDecl: return "ParmDecl"; return "EnumDecl";
case CXCursor_ObjCInterfaceDecl: return "ObjCInterfaceDecl"; case CXCursor_FieldDecl:
case CXCursor_ObjCCategoryDecl: return "ObjCCategoryDecl"; return "FieldDecl";
case CXCursor_ObjCProtocolDecl: return "ObjCProtocolDecl"; case CXCursor_EnumConstantDecl:
case CXCursor_ObjCPropertyDecl: return "ObjCPropertyDecl"; return "EnumConstantDecl";
case CXCursor_ObjCIvarDecl: return "ObjCIvarDecl"; case CXCursor_FunctionDecl:
case CXCursor_ObjCInstanceMethodDecl: return "ObjCInstanceMethodDecl"; return "FunctionDecl";
case CXCursor_ObjCClassMethodDecl: return "ObjCClassMethodDecl"; case CXCursor_VarDecl:
case CXCursor_ObjCImplementationDecl: return "ObjCImplementationDecl"; return "VarDecl";
case CXCursor_ObjCCategoryImplDecl: return "ObjCCategoryImplDecl"; case CXCursor_ParmDecl:
case CXCursor_TypedefDecl: return "TypedefDecl"; return "ParmDecl";
case CXCursor_CXXMethod: return "CXXMethod"; case CXCursor_ObjCInterfaceDecl:
case CXCursor_Namespace: return "Namespace"; return "ObjCInterfaceDecl";
case CXCursor_LinkageSpec: return "LinkageSpec"; case CXCursor_ObjCCategoryDecl:
case CXCursor_Constructor: return "Constructor"; return "ObjCCategoryDecl";
case CXCursor_Destructor: return "Destructor"; case CXCursor_ObjCProtocolDecl:
case CXCursor_ConversionFunction: return "ConversionFunction"; return "ObjCProtocolDecl";
case CXCursor_TemplateTypeParameter: return "TemplateTypeParameter"; case CXCursor_ObjCPropertyDecl:
case CXCursor_NonTypeTemplateParameter: return "NonTypeTemplateParameter"; return "ObjCPropertyDecl";
case CXCursor_TemplateTemplateParameter: return "TemplateTemplateParameter"; case CXCursor_ObjCIvarDecl:
case CXCursor_FunctionTemplate: return "FunctionTemplate"; return "ObjCIvarDecl";
case CXCursor_ClassTemplate: return "ClassTemplate"; case CXCursor_ObjCInstanceMethodDecl:
case CXCursor_ClassTemplatePartialSpecialization: return "ClassTemplatePartialSpecialization"; return "ObjCInstanceMethodDecl";
case CXCursor_NamespaceAlias: return "NamespaceAlias"; case CXCursor_ObjCClassMethodDecl:
case CXCursor_UsingDirective: return "UsingDirective"; return "ObjCClassMethodDecl";
case CXCursor_UsingDeclaration: return "UsingDeclaration"; case CXCursor_ObjCImplementationDecl:
case CXCursor_TypeAliasDecl: return "TypeAliasDecl"; return "ObjCImplementationDecl";
case CXCursor_ObjCSynthesizeDecl: return "ObjCSynthesizeDecl"; case CXCursor_ObjCCategoryImplDecl:
case CXCursor_ObjCDynamicDecl: return "ObjCDynamicDecl"; return "ObjCCategoryImplDecl";
case CXCursor_CXXAccessSpecifier: return "CXXAccessSpecifier"; 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_FirstDecl: return "FirstDecl";
// case CXCursor_LastDecl: return "LastDecl"; // case CXCursor_LastDecl: return "LastDecl";
// case CXCursor_FirstRef: return "FirstRef"; // case CXCursor_FirstRef: return "FirstRef";
case CXCursor_ObjCSuperClassRef: return "ObjCSuperClassRef"; case CXCursor_ObjCSuperClassRef:
case CXCursor_ObjCProtocolRef: return "ObjCProtocolRef"; return "ObjCSuperClassRef";
case CXCursor_ObjCClassRef: return "ObjCClassRef"; case CXCursor_ObjCProtocolRef:
case CXCursor_TypeRef: return "TypeRef"; return "ObjCProtocolRef";
case CXCursor_CXXBaseSpecifier: return "CXXBaseSpecifier"; case CXCursor_ObjCClassRef:
case CXCursor_TemplateRef: return "TemplateRef"; return "ObjCClassRef";
case CXCursor_NamespaceRef: return "NamespaceRef"; case CXCursor_TypeRef:
case CXCursor_MemberRef: return "MemberRef"; return "TypeRef";
case CXCursor_LabelRef: return "LabelRef"; case CXCursor_CXXBaseSpecifier:
case CXCursor_OverloadedDeclRef: return "OverloadedDeclRef"; return "CXXBaseSpecifier";
case CXCursor_VariableRef: return "VariableRef"; 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_LastRef: return "LastRef";
// case CXCursor_FirstInvalid: return "FirstInvalid"; // case CXCursor_FirstInvalid: return "FirstInvalid";
case CXCursor_InvalidFile: return "InvalidFile"; case CXCursor_InvalidFile:
case CXCursor_NoDeclFound: return "NoDeclFound"; return "InvalidFile";
case CXCursor_NotImplemented: return "NotImplemented"; case CXCursor_NoDeclFound:
case CXCursor_InvalidCode: return "InvalidCode"; return "NoDeclFound";
case CXCursor_NotImplemented:
return "NotImplemented";
case CXCursor_InvalidCode:
return "InvalidCode";
// case CXCursor_LastInvalid: return "LastInvalid"; // case CXCursor_LastInvalid: return "LastInvalid";
// case CXCursor_FirstExpr: return "FirstExpr"; // case CXCursor_FirstExpr: return "FirstExpr";
case CXCursor_UnexposedExpr: return "UnexposedExpr"; case CXCursor_UnexposedExpr:
case CXCursor_DeclRefExpr: return "DeclRefExpr"; return "UnexposedExpr";
case CXCursor_MemberRefExpr: return "MemberRefExpr"; case CXCursor_DeclRefExpr:
case CXCursor_CallExpr: return "CallExpr"; return "DeclRefExpr";
case CXCursor_ObjCMessageExpr: return "ObjCMessageExpr"; case CXCursor_MemberRefExpr:
case CXCursor_BlockExpr: return "BlockExpr"; return "MemberRefExpr";
case CXCursor_IntegerLiteral: return "IntegerLiteral"; case CXCursor_CallExpr:
case CXCursor_FloatingLiteral: return "FloatingLiteral"; return "CallExpr";
case CXCursor_ImaginaryLiteral: return "ImaginaryLiteral"; case CXCursor_ObjCMessageExpr:
case CXCursor_StringLiteral: return "StringLiteral"; return "ObjCMessageExpr";
case CXCursor_CharacterLiteral: return "CharacterLiteral"; case CXCursor_BlockExpr:
case CXCursor_ParenExpr: return "ParenExpr"; return "BlockExpr";
case CXCursor_UnaryOperator: return "UnaryOperator"; case CXCursor_IntegerLiteral:
case CXCursor_ArraySubscriptExpr: return "ArraySubscriptExpr"; return "IntegerLiteral";
case CXCursor_BinaryOperator: return "BinaryOperator"; case CXCursor_FloatingLiteral:
case CXCursor_CompoundAssignOperator: return "CompoundAssignOperator"; return "FloatingLiteral";
case CXCursor_ConditionalOperator: return "ConditionalOperator"; case CXCursor_ImaginaryLiteral:
case CXCursor_CStyleCastExpr: return "CStyleCastExpr"; return "ImaginaryLiteral";
case CXCursor_CompoundLiteralExpr: return "CompoundLiteralExpr"; case CXCursor_StringLiteral:
case CXCursor_InitListExpr: return "InitListExpr"; return "StringLiteral";
case CXCursor_AddrLabelExpr: return "AddrLabelExpr"; case CXCursor_CharacterLiteral:
case CXCursor_StmtExpr: return "StmtExpr"; return "CharacterLiteral";
case CXCursor_GenericSelectionExpr: return "GenericSelectionExpr"; case CXCursor_ParenExpr:
case CXCursor_GNUNullExpr: return "GNUNullExpr"; return "ParenExpr";
case CXCursor_CXXStaticCastExpr: return "CXXStaticCastExpr"; case CXCursor_UnaryOperator:
case CXCursor_CXXDynamicCastExpr: return "CXXDynamicCastExpr"; return "UnaryOperator";
case CXCursor_CXXReinterpretCastExpr: return "CXXReinterpretCastExpr"; case CXCursor_ArraySubscriptExpr:
case CXCursor_CXXConstCastExpr: return "CXXConstCastExpr"; return "ArraySubscriptExpr";
case CXCursor_CXXFunctionalCastExpr: return "CXXFunctionalCastExpr"; case CXCursor_BinaryOperator:
case CXCursor_CXXTypeidExpr: return "CXXTypeidExpr"; return "BinaryOperator";
case CXCursor_CXXBoolLiteralExpr: return "CXXBoolLiteralExpr"; case CXCursor_CompoundAssignOperator:
case CXCursor_CXXNullPtrLiteralExpr: return "CXXNullPtrLiteralExpr"; return "CompoundAssignOperator";
case CXCursor_CXXThisExpr: return "CXXThisExpr"; case CXCursor_ConditionalOperator:
case CXCursor_CXXThrowExpr: return "CXXThrowExpr"; return "ConditionalOperator";
case CXCursor_CXXNewExpr: return "CXXNewExpr"; case CXCursor_CStyleCastExpr:
case CXCursor_CXXDeleteExpr: return "CXXDeleteExpr"; return "CStyleCastExpr";
case CXCursor_UnaryExpr: return "UnaryExpr"; case CXCursor_CompoundLiteralExpr:
case CXCursor_ObjCStringLiteral: return "ObjCStringLiteral"; return "CompoundLiteralExpr";
case CXCursor_ObjCEncodeExpr: return "ObjCEncodeExpr"; case CXCursor_InitListExpr:
case CXCursor_ObjCSelectorExpr: return "ObjCSelectorExpr"; return "InitListExpr";
case CXCursor_ObjCProtocolExpr: return "ObjCProtocolExpr"; case CXCursor_AddrLabelExpr:
case CXCursor_ObjCBridgedCastExpr: return "ObjCBridgedCastExpr"; return "AddrLabelExpr";
case CXCursor_PackExpansionExpr: return "PackExpansionExpr"; case CXCursor_StmtExpr:
case CXCursor_SizeOfPackExpr: return "SizeOfPackExpr"; return "StmtExpr";
case CXCursor_LambdaExpr: return "LambdaExpr"; case CXCursor_GenericSelectionExpr:
case CXCursor_ObjCBoolLiteralExpr: return "ObjCBoolLiteralExpr"; return "GenericSelectionExpr";
case CXCursor_ObjCSelfExpr: return "ObjCSelfExpr"; 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_LastExpr: return "LastExpr";
// case CXCursor_FirstStmt: return "FirstStmt"; // case CXCursor_FirstStmt: return "FirstStmt";
case CXCursor_UnexposedStmt: return "UnexposedStmt"; case CXCursor_UnexposedStmt:
case CXCursor_LabelStmt: return "LabelStmt"; return "UnexposedStmt";
case CXCursor_CompoundStmt: return "CompoundStmt"; case CXCursor_LabelStmt:
case CXCursor_CaseStmt: return "CaseStmt"; return "LabelStmt";
case CXCursor_DefaultStmt: return "DefaultStmt"; case CXCursor_CompoundStmt:
case CXCursor_IfStmt: return "IfStmt"; return "CompoundStmt";
case CXCursor_SwitchStmt: return "SwitchStmt"; case CXCursor_CaseStmt:
case CXCursor_WhileStmt: return "WhileStmt"; return "CaseStmt";
case CXCursor_DoStmt: return "DoStmt"; case CXCursor_DefaultStmt:
case CXCursor_ForStmt: return "ForStmt"; return "DefaultStmt";
case CXCursor_GotoStmt: return "GotoStmt"; case CXCursor_IfStmt:
case CXCursor_IndirectGotoStmt: return "IndirectGotoStmt"; return "IfStmt";
case CXCursor_ContinueStmt: return "ContinueStmt"; case CXCursor_SwitchStmt:
case CXCursor_BreakStmt: return "BreakStmt"; return "SwitchStmt";
case CXCursor_ReturnStmt: return "ReturnStmt"; case CXCursor_WhileStmt:
case CXCursor_GCCAsmStmt: return "GCCAsmStmt"; 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_AsmStmt: return "AsmStmt";
case CXCursor_ObjCAtTryStmt: return "ObjCAtTryStmt"; case CXCursor_ObjCAtTryStmt:
case CXCursor_ObjCAtCatchStmt: return "ObjCAtCatchStmt"; return "ObjCAtTryStmt";
case CXCursor_ObjCAtFinallyStmt: return "ObjCAtFinallyStmt"; case CXCursor_ObjCAtCatchStmt:
case CXCursor_ObjCAtThrowStmt: return "ObjCAtThrowStmt"; return "ObjCAtCatchStmt";
case CXCursor_ObjCAtSynchronizedStmt: return "ObjCAtSynchronizedStmt"; case CXCursor_ObjCAtFinallyStmt:
case CXCursor_ObjCAutoreleasePoolStmt: return "ObjCAutoreleasePoolStmt"; return "ObjCAtFinallyStmt";
case CXCursor_ObjCForCollectionStmt: return "ObjCForCollectionStmt"; case CXCursor_ObjCAtThrowStmt:
case CXCursor_CXXCatchStmt: return "CXXCatchStmt"; return "ObjCAtThrowStmt";
case CXCursor_CXXTryStmt: return "CXXTryStmt"; case CXCursor_ObjCAtSynchronizedStmt:
case CXCursor_CXXForRangeStmt: return "CXXForRangeStmt"; return "ObjCAtSynchronizedStmt";
case CXCursor_SEHTryStmt: return "SEHTryStmt"; case CXCursor_ObjCAutoreleasePoolStmt:
case CXCursor_SEHExceptStmt: return "SEHExceptStmt"; return "ObjCAutoreleasePoolStmt";
case CXCursor_SEHFinallyStmt: return "SEHFinallyStmt"; case CXCursor_ObjCForCollectionStmt:
case CXCursor_MSAsmStmt: return "MSAsmStmt"; return "ObjCForCollectionStmt";
case CXCursor_NullStmt: return "NullStmt"; case CXCursor_CXXCatchStmt:
case CXCursor_DeclStmt: return "DeclStmt"; return "CXXCatchStmt";
case CXCursor_LastStmt: return "LastStmt"; case CXCursor_CXXTryStmt:
case CXCursor_TranslationUnit: return "TranslationUnit"; 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_FirstAttr: return "FirstAttr";
case CXCursor_UnexposedAttr: return "UnexposedAttr"; case CXCursor_UnexposedAttr:
case CXCursor_IBActionAttr: return "IBActionAttr"; return "UnexposedAttr";
case CXCursor_IBOutletAttr: return "IBOutletAttr"; case CXCursor_IBActionAttr:
case CXCursor_IBOutletCollectionAttr: return "IBOutletCollectionAttr"; return "IBActionAttr";
case CXCursor_CXXFinalAttr: return "CXXFinalAttr"; case CXCursor_IBOutletAttr:
case CXCursor_CXXOverrideAttr: return "CXXOverrideAttr"; return "IBOutletAttr";
case CXCursor_AnnotateAttr: return "AnnotateAttr"; case CXCursor_IBOutletCollectionAttr:
case CXCursor_AsmLabelAttr: return "AsmLabelAttr"; return "IBOutletCollectionAttr";
case CXCursor_LastAttr: return "LastAttr"; case CXCursor_CXXFinalAttr:
case CXCursor_PreprocessingDirective: return "PreprocessingDirective"; return "CXXFinalAttr";
case CXCursor_MacroDefinition: return "MacroDefinition"; case CXCursor_CXXOverrideAttr:
case CXCursor_MacroExpansion: return "MacroExpansion"; 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_MacroInstantiation: return "MacroInstantiation";
case CXCursor_InclusionDirective: return "InclusionDirective"; case CXCursor_InclusionDirective:
return "InclusionDirective";
// case CXCursor_FirstPreprocessing: return "FirstPreprocessing"; // case CXCursor_FirstPreprocessing: return "FirstPreprocessing";
// case CXCursor_LastPreprocessing: return "LastPreprocessing"; // case CXCursor_LastPreprocessing: return "LastPreprocessing";
case CXCursor_ModuleImportDecl: return "ModuleImportDecl"; case CXCursor_ModuleImportDecl:
return "ModuleImportDecl";
// case CXCursor_FirstExtraDecl: return "FirstExtraDecl"; // case CXCursor_FirstExtraDecl: return "FirstExtraDecl";
case CXCursor_LastExtraDecl: return "LastExtraDecl"; case CXCursor_LastExtraDecl:
return "LastExtraDecl";
} }
return "<unknown kind>"; return "<unknown kind>";
} }