#include "CIndexDiagnostic.h"
#include "CIndexer.h"
#include "CLog.h"
#include "CXCursor.h"
#include "CXIndexDataConsumer.h"
#include "CXSourceLocation.h"
#include "CXString.h"
#include "CXTranslationUnit.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Frontend/MultiplexConsumer.h"
#include "clang/Frontend/Utils.h"
#include "clang/Index/IndexingAction.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/PPConditionalDirectiveRecord.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/MemoryBuffer.h"
#include <cstdio>
#include <mutex>
#include <utility>
usingnamespaceclang;
usingnamespaceclang::index;
usingnamespacecxtu;
usingnamespacecxindex;
namespace {
class PPRegion { … };
}
namespace llvm {
template <>
struct DenseMapInfo<PPRegion> { … };
}
namespace {
class ThreadSafeParsedRegions { … };
class ParsedSrcLocationsTracker { … };
class IndexPPCallbacks : public PPCallbacks { … };
class IndexingConsumer : public ASTConsumer { … };
class CaptureDiagnosticConsumer : public DiagnosticConsumer { … };
class IndexingFrontendAction : public ASTFrontendAction { … };
static IndexingOptions getIndexingOptionsFromCXOptions(unsigned index_options) { … }
struct IndexSessionData { … };
}
static CXErrorCode clang_indexSourceFile_Impl(
CXIndexAction cxIdxAction, CXClientData client_data,
IndexerCallbacks *client_index_callbacks, unsigned index_callbacks_size,
unsigned index_options, const char *source_filename,
const char *const *command_line_args, int num_command_line_args,
ArrayRef<CXUnsavedFile> unsaved_files, CXTranslationUnit *out_TU,
unsigned TU_options) { … }
static void indexPreprocessingRecord(ASTUnit &Unit, CXIndexDataConsumer &IdxCtx) { … }
static CXErrorCode clang_indexTranslationUnit_Impl(
CXIndexAction idxAction, CXClientData client_data,
IndexerCallbacks *client_index_callbacks, unsigned index_callbacks_size,
unsigned index_options, CXTranslationUnit TU) { … }
int clang_index_isEntityObjCContainerKind(CXIdxEntityKind K) { … }
const CXIdxObjCContainerDeclInfo *
clang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *DInfo) { … }
const CXIdxObjCInterfaceDeclInfo *
clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *DInfo) { … }
const CXIdxObjCCategoryDeclInfo *
clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *DInfo){ … }
const CXIdxObjCProtocolRefListInfo *
clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *DInfo) { … }
const CXIdxObjCPropertyDeclInfo *
clang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *DInfo) { … }
const CXIdxIBOutletCollectionAttrInfo *
clang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *AInfo) { … }
const CXIdxCXXClassDeclInfo *
clang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *DInfo) { … }
CXIdxClientContainer
clang_index_getClientContainer(const CXIdxContainerInfo *info) { … }
void clang_index_setClientContainer(const CXIdxContainerInfo *info,
CXIdxClientContainer client) { … }
CXIdxClientEntity clang_index_getClientEntity(const CXIdxEntityInfo *info) { … }
void clang_index_setClientEntity(const CXIdxEntityInfo *info,
CXIdxClientEntity client) { … }
CXIndexAction clang_IndexAction_create(CXIndex CIdx) { … }
void clang_IndexAction_dispose(CXIndexAction idxAction) { … }
int clang_indexSourceFile(CXIndexAction idxAction,
CXClientData client_data,
IndexerCallbacks *index_callbacks,
unsigned index_callbacks_size,
unsigned index_options,
const char *source_filename,
const char * const *command_line_args,
int num_command_line_args,
struct CXUnsavedFile *unsaved_files,
unsigned num_unsaved_files,
CXTranslationUnit *out_TU,
unsigned TU_options) { … }
int clang_indexSourceFileFullArgv(
CXIndexAction idxAction, CXClientData client_data,
IndexerCallbacks *index_callbacks, unsigned index_callbacks_size,
unsigned index_options, const char *source_filename,
const char *const *command_line_args, int num_command_line_args,
struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
CXTranslationUnit *out_TU, unsigned TU_options) { … }
int clang_indexTranslationUnit(CXIndexAction idxAction,
CXClientData client_data,
IndexerCallbacks *index_callbacks,
unsigned index_callbacks_size,
unsigned index_options,
CXTranslationUnit TU) { … }
void clang_indexLoc_getFileLocation(CXIdxLoc location,
CXIdxClientFile *indexFile,
CXFile *file,
unsigned *line,
unsigned *column,
unsigned *offset) { … }
CXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc location) { … }