2017-11-11 19:41:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "clang_cursor.h"
|
|
|
|
#include "clang_index.h"
|
|
|
|
|
|
|
|
#include <clang-c/Index.h>
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
// RAII wrapper around CXTranslationUnit which also makes it much more
|
|
|
|
// challenging to use a CXTranslationUnit instance that is not correctly
|
|
|
|
// initialized.
|
2017-12-24 01:30:52 +00:00
|
|
|
struct ClangTranslationUnit {
|
2017-11-11 19:41:09 +00:00
|
|
|
static std::unique_ptr<ClangTranslationUnit> Create(
|
|
|
|
ClangIndex* index,
|
|
|
|
const std::string& filepath,
|
|
|
|
const std::vector<std::string>& arguments,
|
2018-01-18 01:52:35 +00:00
|
|
|
std::vector<CXUnsavedFile>& unsaved_files,
|
2017-11-11 19:41:09 +00:00
|
|
|
unsigned flags);
|
|
|
|
|
|
|
|
static std::unique_ptr<ClangTranslationUnit> Reparse(
|
|
|
|
std::unique_ptr<ClangTranslationUnit> tu,
|
|
|
|
std::vector<CXUnsavedFile>& unsaved);
|
|
|
|
|
|
|
|
explicit ClangTranslationUnit(CXTranslationUnit tu);
|
|
|
|
~ClangTranslationUnit();
|
|
|
|
|
|
|
|
CXTranslationUnit cx_tu;
|
|
|
|
};
|