]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/CIndex/CXCursor.h
Update clang to 97654.
[FreeBSD/FreeBSD.git] / tools / CIndex / CXCursor.h
1 //===- CXCursor.h - Routines for manipulating CXCursors -------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines routines for manipulating CXCursors.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CLANG_CXCURSOR_H
15 #define LLVM_CLANG_CXCURSOR_H
16
17 #include "clang-c/Index.h"
18 #include "clang/Basic/SourceLocation.h"
19 #include <utility>
20
21 namespace clang {
22
23 class ASTContext;
24 class ASTUnit;
25 class Attr;
26 class Decl;
27 class Expr;
28 class NamedDecl;
29 class ObjCInterfaceDecl;
30 class ObjCProtocolDecl;
31 class Stmt;
32 class TypeDecl;
33
34 namespace cxcursor {
35   
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);
40
41 /// \brief Create an Objective-C superclass reference at the given location.
42 CXCursor MakeCursorObjCSuperClassRef(ObjCInterfaceDecl *Super, 
43                                      SourceLocation Loc, 
44                                      ASTUnit *TU);
45
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);
50
51 /// \brief Create an Objective-C protocol reference at the given location.
52 CXCursor MakeCursorObjCProtocolRef(ObjCProtocolDecl *Proto, SourceLocation Loc, 
53                                    ASTUnit *TU);
54
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);
59
60 /// \brief Create an Objective-C class reference at the given location.
61 CXCursor MakeCursorObjCClassRef(ObjCInterfaceDecl *Class, SourceLocation Loc, 
62                                 ASTUnit *TU);
63
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);
68
69 /// \brief Create a type reference at the given location.
70 CXCursor MakeCursorTypeRef(TypeDecl *Type, SourceLocation Loc, ASTUnit *TU);
71
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);
75
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);
81   
82 bool operator==(CXCursor X, CXCursor Y);
83   
84 inline bool operator!=(CXCursor X, CXCursor Y) {
85   return !(X == Y);
86 }
87
88 }} // end namespace: clang::cxcursor
89
90 #endif