blob: 26bbc7d59c81adf931797f0449e4e78fd1483789 [file] [log] [blame]
Ted Kremenek87553c42010-01-15 20:35:54 +00001//===- 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"
Douglas Gregor6c8959b2010-01-16 14:00:32 +000018#include "clang/Basic/SourceLocation.h"
19#include <utility>
Ted Kremenek87553c42010-01-15 20:35:54 +000020
21namespace clang {
22
23class Decl;
Douglas Gregorc58d05b2010-01-15 21:56:13 +000024class Expr;
25class NamedDecl;
Douglas Gregor6c8959b2010-01-16 14:00:32 +000026class ObjCInterfaceDecl;
Douglas Gregoref6eb842010-01-16 15:44:18 +000027class ObjCProtocolDecl;
Ted Kremenek87553c42010-01-15 20:35:54 +000028class Stmt;
29
30namespace cxcursor {
31
32CXCursor MakeCXCursor(CXCursorKind K, clang::Decl *D);
33CXCursor MakeCXCursor(CXCursorKind K, clang::Decl *D, clang::Stmt *S);
Ted Kremenekc2aa0f12010-01-16 00:36:30 +000034CXCursor MakeCXCursor(clang::Decl *D);
Ted Kremenek87553c42010-01-15 20:35:54 +000035
Douglas Gregor6c8959b2010-01-16 14:00:32 +000036/// \brief Create an Objective-C superclass reference at the given location.
37CXCursor MakeCursorObjCSuperClassRef(ObjCInterfaceDecl *Super,
38 SourceLocation Loc);
39
40/// \brief Unpack an ObjCSuperClassRef cursor into the interface it references
41/// and optionally the location where the reference occurred.
42std::pair<ObjCInterfaceDecl *, SourceLocation>
Douglas Gregoref6eb842010-01-16 15:44:18 +000043 getCursorObjCSuperClassRef(CXCursor C);
44
45/// \brief Create an Objective-C protocol reference at the given location.
46CXCursor MakeCursorObjCProtocolRef(ObjCProtocolDecl *Proto, SourceLocation Loc);
47
48/// \brief Unpack an ObjCProtocolRef cursor into the protocol it references
49/// and optionally the location where the reference occurred.
50std::pair<ObjCProtocolDecl *, SourceLocation>
51 getCursorObjCProtocolRef(CXCursor C);
Douglas Gregor6c8959b2010-01-16 14:00:32 +000052
Douglas Gregorc58d05b2010-01-15 21:56:13 +000053Decl *getCursorDecl(CXCursor Cursor);
54Expr *getCursorExpr(CXCursor Cursor);
55Stmt *getCursorStmt(CXCursor Cursor);
56Decl *getCursorReferringDecl(CXCursor Cursor);
57NamedDecl *getCursorInterfaceParent(CXCursor Cursor);
58
59bool operator==(CXCursor X, CXCursor Y);
60
61inline bool operator!=(CXCursor X, CXCursor Y) {
62 return !(X == Y);
63}
64
Ted Kremenek87553c42010-01-15 20:35:54 +000065}} // end namespace: clang::cxcursor
66
67#endif