//===- CIndex.cpp - Clang-C Source Indexing Library -----------------------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file implements the main API hooks in the Clang-C Source Indexing// library.////===----------------------------------------------------------------------===//#include"CIndexer.h"#include"CXCursor.h"#include"clang/AST/DeclVisitor.h"#include"clang/AST/StmtVisitor.h"#include"clang/AST/TypeLocVisitor.h"#include"clang/Lex/Lexer.h"#include"llvm/Support/MemoryBuffer.h"#include"llvm/System/Program.h"// Needed to define L_TMPNAM on some systems.#include<cstdio>usingnamespaceclang;usingnamespaceclang::cxcursor;usingnamespaceidx;//===----------------------------------------------------------------------===//// Crash Reporting.//===----------------------------------------------------------------------===//#ifdef __APPLE__#ifndef NDEBUG#define USE_CRASHTRACER#include"clang/Analysis/Support/SaveAndRestore.h"// Integrate with crash reporter.extern"C"constchar*__crashreporter_info__;#define NUM_CRASH_STRINGS 16staticunsignedcrashtracer_counter=0;staticunsignedcrashtracer_counter_id[NUM_CRASH_STRINGS]={0};staticconstchar*crashtracer_strings[NUM_CRASH_STRINGS]={0};staticconstchar*agg_crashtracer_strings[NUM_CRASH_STRINGS]={0};staticunsignedSetCrashTracerInfo(constchar*str,llvm::SmallString<1024>&AggStr){unsignedslot=0;while(