blob: a168f160451bb3b5638f6b5a59e6ec1e31c464fb [file] [log] [blame]
Ted Kremenek585b3182010-08-27 21:57:20 +00001//===- CIndexCXX.cpp - Clang-C Source Indexing Library --------------------===//
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 implements the libclang support for C++ cursors.
11//
12//===----------------------------------------------------------------------===//
13
14#include "CIndexer.h"
15#include "CXCursor.h"
16#include "CXType.h"
17#include "clang/AST/DeclCXX.h"
18
19using namespace clang;
20using namespace clang::cxstring;
21
22extern "C" {
23
24unsigned clang_isVirtualBase(CXCursor C) {
25 if (C.kind != CXCursor_CXXBaseSpecifier)
26 return 0;
27
28 CXXBaseSpecifier *B = cxcursor::getCursorCXXBaseSpecifier(C);
29 return B->isVirtual();
30}
31
32enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor C) {
33 if (C.kind != CXCursor_CXXBaseSpecifier)
34 return CX_CXXInvalidAccessSpecifier;
35
36 CXXBaseSpecifier *B = cxcursor::getCursorCXXBaseSpecifier(C);
37 switch (B->getAccessSpecifier()) {
38 case AS_public: return CX_CXXPublic;
39 case AS_protected: return CX_CXXProtected;
40 case AS_private: return CX_CXXPrivate;
41 case AS_none: return CX_CXXInvalidAccessSpecifier;
42 }
43
44 // FIXME: Clang currently thinks this is reachable.
45 return CX_CXXInvalidAccessSpecifier;
46}
47
48} // end extern "C"