diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-06 07:00:54 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-06 07:00:54 +0000 |
commit | aed123ec3cc37e457fe20a6158fdadf8849ad916 (patch) | |
tree | 3c966b7fabc78150142d829f20b4be00cceb3d0a /tools/libclang/CXCursor.h | |
parent | b11be041e4f05519a2eabf6a99429ba6110f1ca9 (diff) |
[libclang] Introduce clang_findReferencesInFile which accepts a cursor, a file,
and a callback and finds all identifier references of the cursor in the file.
rdar://7948304
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141277 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CXCursor.h')
-rw-r--r-- | tools/libclang/CXCursor.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tools/libclang/CXCursor.h b/tools/libclang/CXCursor.h index 5d9d5683c4..e3ca2680f1 100644 --- a/tools/libclang/CXCursor.h +++ b/tools/libclang/CXCursor.h @@ -49,9 +49,11 @@ CXCursor getCursor(CXTranslationUnit, SourceLocation); CXCursor MakeCXCursor(const clang::Attr *A, clang::Decl *Parent, CXTranslationUnit TU); CXCursor MakeCXCursor(clang::Decl *D, CXTranslationUnit TU, + SourceRange RegionOfInterest = SourceRange(), bool FirstInDeclGroup = true); CXCursor MakeCXCursor(clang::Stmt *S, clang::Decl *Parent, - CXTranslationUnit TU); + CXTranslationUnit TU, + SourceRange RegionOfInterest = SourceRange()); CXCursor MakeCXCursorInvalid(CXCursorKind K); /// \brief Create an Objective-C superclass reference at the given location. @@ -195,6 +197,27 @@ CXTranslationUnit getCursorTU(CXCursor Cursor); void getOverriddenCursors(CXCursor cursor, SmallVectorImpl<CXCursor> &overridden); +/// \brief Returns a index/location pair for a selector identifier if the cursor +/// points to one. +std::pair<int, SourceLocation> getSelectorIdentifierIndexAndLoc(CXCursor); +static inline int getSelectorIdentifierIndex(CXCursor cursor) { + return getSelectorIdentifierIndexAndLoc(cursor).first; +} +static inline SourceLocation getSelectorIdentifierLoc(CXCursor cursor) { + return getSelectorIdentifierIndexAndLoc(cursor).second; +} + +CXCursor getSelectorIdentifierCursor(int SelIdx, CXCursor cursor); + +static inline CXCursor getTypeRefedCallExprCursor(CXCursor cursor) { + CXCursor newCursor = cursor; + if (cursor.kind == CXCursor_CallExpr) + newCursor.xdata = 1; + return newCursor; +} + +CXCursor getTypeRefCursor(CXCursor cursor); + bool operator==(CXCursor X, CXCursor Y); inline bool operator!=(CXCursor X, CXCursor Y) { |