#ifndef LLVM_CLANG_CINDEXER_H
#define LLVM_CLANG_CINDEXER_H
#include "clang-c/Index.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Path.h"
#include <vector>
namespace llvm {
class CrashRecoveryContext;
}
namespace clang {
class ASTUnit;
class CIndexer {
bool OnlyLocalDecls;
bool DisplayDiagnostics;
unsigned Options;
llvm::sys::Path ResourcesPath;
std::string WorkingDir;
public:
CIndexer() : OnlyLocalDecls(false), DisplayDiagnostics(false),
Options(CXGlobalOpt_None) { }
bool getOnlyLocalDecls() const { return OnlyLocalDecls; }
void setOnlyLocalDecls(bool Local = true) { OnlyLocalDecls = Local; }
bool getDisplayDiagnostics() const { return DisplayDiagnostics; }
void setDisplayDiagnostics(bool Display = true) {
DisplayDiagnostics = Display;
}
unsigned getCXGlobalOptFlags() const { return Options; }
void setCXGlobalOptFlags(unsigned options) { Options = options; }
bool isOptEnabled(CXGlobalOptFlags opt) const {
return Options & opt;
}
std::string getClangResourcesPath();
const std::string &getWorkingDirectory() const { return WorkingDir; }
void setWorkingDirectory(const std::string &Dir) { WorkingDir = Dir; }
};
bool RemapFiles(unsigned num_unsaved_files,
struct CXUnsavedFile *unsaved_files,
std::vector<std::string> &RemapArgs,
std::vector<llvm::sys::Path> &TemporaryFiles);
unsigned GetSafetyThreadStackSize();
void SetSafetyThreadStackSize(unsigned Value);
bool RunSafely(llvm::CrashRecoveryContext &CRC,
void (*Fn)(void*), void *UserData, unsigned Size = 0);
void setThreadBackgroundPriority();
void PrintLibclangResourceUsage(CXTranslationUnit TU);
namespace cxindex {
void printDiagsToStderr(ASTUnit *Unit);
}
}
#endif