Browse Source

getting translation unit cursor

merge-requests/37/head
Szymon Sobik 7 years ago
parent
commit
ee128a07cc
  1. 4
      src/translation_unit.cc
  2. 1
      src/translation_unit.h

4
src/translation_unit.cc

@ -93,6 +93,10 @@ std::unique_ptr<clangmm::Tokens> clangmm::TranslationUnit::get_tokens(unsigned s
return std::unique_ptr<Tokens>(new Tokens(cx_tu, range));
}
clangmm::Cursor clangmm::TranslationUnit::get_cursor() {
return Cursor(clang_getTranslationUnitCursor(cx_tu));
}
clangmm::Cursor clangmm::TranslationUnit::get_cursor(const std::string &path, unsigned offset) {
SourceLocation location(cx_tu, path, offset);
return Cursor(clang_getCursor(cx_tu, location.cx_location));

1
src/translation_unit.h

@ -37,6 +37,7 @@ namespace clangmm {
std::unique_ptr<Tokens> get_tokens(unsigned start_line, unsigned start_column,
unsigned end_line, unsigned end_column);
Cursor get_cursor();
Cursor get_cursor(const std::string &path, unsigned offset);
Cursor get_cursor(const std::string &path, unsigned line, unsigned column);
Cursor get_cursor(const SourceLocation &location);

Loading…
Cancel
Save