1 //===- CXCursor.h - Routines for manipulating CXCursors -------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines routines for manipulating CXCursors.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_CXCURSOR_H
15 #define LLVM_CLANG_CXCURSOR_H
17 #include "clang-c/Index.h"
18 #include "clang/Basic/SourceLocation.h"
29 class ObjCInterfaceDecl;
30 class ObjCProtocolDecl;
36 CXCursor MakeCXCursor(const clang::Attr *A, clang::Decl *Parent, ASTUnit *TU);
37 CXCursor MakeCXCursor(clang::Decl *D, ASTUnit *TU);
38 CXCursor MakeCXCursor(clang::Stmt *S, clang::Decl *Parent, ASTUnit *TU);
39 CXCursor MakeCXCursorInvalid(CXCursorKind K);
41 /// \brief Create an Objective-C superclass reference at the given location.
42 CXCursor MakeCursorObjCSuperClassRef(ObjCInterfaceDecl *Super,
46 /// \brief Unpack an ObjCSuperClassRef cursor into the interface it references
47 /// and optionally the location where the reference occurred.
48 std::pair<ObjCInterfaceDecl *, SourceLocation>
49 getCursorObjCSuperClassRef(CXCursor C);
51 /// \brief Create an Objective-C protocol reference at the given location.
52 CXCursor MakeCursorObjCProtocolRef(ObjCProtocolDecl *Proto, SourceLocation Loc,
55 /// \brief Unpack an ObjCProtocolRef cursor into the protocol it references
56 /// and optionally the location where the reference occurred.
57 std::pair<ObjCProtocolDecl *, SourceLocation>
58 getCursorObjCProtocolRef(CXCursor C);
60 /// \brief Create an Objective-C class reference at the given location.
61 CXCursor MakeCursorObjCClassRef(ObjCInterfaceDecl *Class, SourceLocation Loc,
64 /// \brief Unpack an ObjCClassRef cursor into the class it references
65 /// and optionally the location where the reference occurred.
66 std::pair<ObjCInterfaceDecl *, SourceLocation>
67 getCursorObjCClassRef(CXCursor C);
69 /// \brief Create a type reference at the given location.
70 CXCursor MakeCursorTypeRef(TypeDecl *Type, SourceLocation Loc, ASTUnit *TU);
72 /// \brief Unpack a TypeRef cursor into the class it references
73 /// and optionally the location where the reference occurred.
74 std::pair<TypeDecl *, SourceLocation> getCursorTypeRef(CXCursor C);
76 Decl *getCursorDecl(CXCursor Cursor);
77 Expr *getCursorExpr(CXCursor Cursor);
78 Stmt *getCursorStmt(CXCursor Cursor);
79 ASTContext &getCursorContext(CXCursor Cursor);
80 ASTUnit *getCursorASTUnit(CXCursor Cursor);
82 bool operator==(CXCursor X, CXCursor Y);
84 inline bool operator!=(CXCursor X, CXCursor Y) {
88 }} // end namespace: clang::cxcursor