mirror of https://gitlab.com/cppit/libclangmm
28 changed files with 243 additions and 139 deletions
@ -1,16 +1,12 @@
|
||||
#ifndef INDEX_H_ |
||||
#define INDEX_H_ |
||||
|
||||
#include <clang-c/Index.h> |
||||
|
||||
namespace clang { |
||||
class TranslationUnit; |
||||
class Index { |
||||
public: |
||||
Index(int excludeDeclarationsFromPCH, int displayDiagnostics); |
||||
private: |
||||
CXIndex index_; |
||||
friend TranslationUnit; |
||||
}; |
||||
} // namespace clang
|
||||
#endif // INDEX_H_
|
||||
|
||||
@ -1,23 +1,32 @@
|
||||
#ifndef SOURCERANGE_H_ |
||||
#define SOURCERANGE_H_ |
||||
#include "TranslationUnit.h" |
||||
#include <clang-c/Index.h> |
||||
#include "Token.h" |
||||
#include "Cursor.h" |
||||
#include "SourceLocation.h" |
||||
#include <string> |
||||
|
||||
namespace clang { |
||||
class Token; |
||||
class SourceLocation; |
||||
class Cursor; |
||||
|
||||
class RangeData { |
||||
public: |
||||
std::string path; |
||||
unsigned start_offset, end_offset; |
||||
}; |
||||
|
||||
class SourceRange { |
||||
public: |
||||
SourceRange() {} |
||||
SourceRange(TranslationUnit *tu, Token *token); |
||||
SourceRange(Token *token); |
||||
SourceRange(SourceLocation *start, |
||||
SourceLocation *end); |
||||
explicit SourceRange(Cursor *cursor); |
||||
|
||||
private: |
||||
static RangeData get_range_data(SourceLocation &start, SourceLocation &end); |
||||
RangeData get_range_data(); |
||||
CXSourceRange range_; |
||||
friend Tokens; |
||||
friend SourceLocation; |
||||
friend Diagnostic; |
||||
}; |
||||
} // namespace clang
|
||||
#endif // SOURCERANGE_H_
|
||||
|
||||
@ -1,21 +1,29 @@
|
||||
#ifndef TOKENS_H_ |
||||
#define TOKENS_H_ |
||||
#include "TranslationUnit.h" |
||||
#include <clang-c/Index.h> |
||||
#include "SourceRange.h" |
||||
#include "Token.h" |
||||
#include <unordered_map> |
||||
#include <vector> |
||||
|
||||
namespace clang { |
||||
class Tokens : public std::vector<clang::Token> { |
||||
public: |
||||
Tokens(TranslationUnit *tu, SourceRange *range); |
||||
Tokens(CXTranslationUnit &tu, SourceRange *range); |
||||
~Tokens(); |
||||
void update_types(clang::TranslationUnit *tu); |
||||
void update_types(); |
||||
std::string get_brief_comments(size_t cursor_id); |
||||
CXCursor find_referenced(); |
||||
bool equalCursors(CXCursor a, CXCursor b); |
||||
void rename(CXCursor &referenced, std::unordered_map<std::string, std::unordered_multimap<unsigned, unsigned> > &ranges); |
||||
|
||||
private: |
||||
CXToken *tokens_; |
||||
unsigned num_tokens_; |
||||
std::vector<CXCursor> clang_cursors; |
||||
TranslationUnit& tu; |
||||
CXTranslationUnit& tu; |
||||
|
||||
static CXChildVisitResult clang_visitor(CXCursor cursor, CXCursor parent, CXClientData clientData); |
||||
}; |
||||
} // namespace clang
|
||||
#endif // TOKENS_H_
|
||||
|
||||
Loading…
Reference in new issue