clang-tags
C/C++ source code indexing tool based on libclang
|
Translation unit. More...
#include <translationUnit.hxx>
Classes | |
struct | TranslationUnit_ |
Public Member Functions | |
void | reparse () |
Reparse the translation unit. | |
void | reparse (UnsavedFiles &unsaved) |
Reparse the translation unit. | |
SourceLocation | getLocation (const char *fileName, unsigned int offset) |
Get the source location for a file/offset in the translation unit. | |
Cursor | cursor () const |
Get a cursor to the translation unit. | |
unsigned int | numDiagnostics () |
Get the number of diagnostic messages for the translation unit. | |
std::string | diagnostic (unsigned int i) |
Get the i-th diagnostic message for the translation unit. | |
const CXTranslationUnit & | raw () const |
Friends | |
class | Index |
class | Cursor |
Translation unit.
This class is a proxy for libclang's CXTranslationUnit
type and should provide the same features, except its lifetime should not have to be explicitly managed.
The preferred way to create TranslationUnit objects is calling Index::parse.
Cursor LibClang::TranslationUnit::cursor | ( | ) | const |
Get a cursor to the translation unit.
This cursor can be used to start traversing the Abstract Syntax Tree (AST) of the translation unit.
std::string LibClang::TranslationUnit::diagnostic | ( | unsigned int | i | ) |
Get the i-th diagnostic message for the translation unit.
These diagnostic messages are those emitted by the compiler when parsing the translation unit.
i | index of the diagnostic message (must be less than numDiagnostics()) |
SourceLocation LibClang::TranslationUnit::getLocation | ( | const char * | fileName, |
unsigned int | offset | ||
) |
Get the source location for a file/offset in the translation unit.
Retrieve the source location associated to a given source file and character offset in the translation unit.
fileName | The source file name |
offset | The offset, counted in characters from the file beginning |
unsigned int LibClang::TranslationUnit::numDiagnostics | ( | ) |
Get the number of diagnostic messages for the translation unit.
These diagnostic messages are those emitted by the compiler when parsing the translation unit.
void LibClang::TranslationUnit::reparse | ( | ) |
Reparse the translation unit.
Re-parse the source files used to create the translation unit, reading up-to-date source code from the file-system. The source code is re-parsed with the same command-line options than the first time.
void LibClang::TranslationUnit::reparse | ( | UnsavedFiles & | unsaved | ) |
Reparse the translation unit.
Re-parse the source files used to create the translation unit, reading up-to-date content from the set of in-memory buffers in unsaved. The source code is re-parsed with the same command-line options than the first time.
unsaved | A set of unsaved contents for the source files |