#pragma once #include "clang_cursor.h" #include "clang_index.h" #include #include #include #include // RAII wrapper around CXTranslationUnit which also makes it much more // challenging to use a CXTranslationUnit instance that is not correctly // initialized. class ClangTranslationUnit { public: static std::unique_ptr Create( ClangIndex* index, const std::string& filepath, const std::vector& arguments, std::vector unsaved_files, unsigned flags); static std::unique_ptr Reparse( std::unique_ptr tu, std::vector& unsaved); explicit ClangTranslationUnit(CXTranslationUnit tu); ~ClangTranslationUnit(); CXTranslationUnit cx_tu; };