summaryrefslogtreecommitdiff
path: root/tools/libclang/CIndexHigh.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2013-01-23 17:25:27 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2013-01-23 17:25:27 +0000
commite22339c44bb28d71a2cc97c840d3da0c4bdb4909 (patch)
tree5288e46873098b5ae526f3ef53957c4ec5528d2c /tools/libclang/CIndexHigh.cpp
parent89cf425f1136f8d24a64ed94450e488b6794dfa4 (diff)
downloadclang-e22339c44bb28d71a2cc97c840d3da0c4bdb4909.tar.gz
clang-e22339c44bb28d71a2cc97c840d3da0c4bdb4909.tar.bz2
clang-e22339c44bb28d71a2cc97c840d3da0c4bdb4909.tar.xz
libclang: change return type of getCursorDecl() to 'const Decl *'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndexHigh.cpp')
-rw-r--r--tools/libclang/CIndexHigh.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/tools/libclang/CIndexHigh.cpp b/tools/libclang/CIndexHigh.cpp
index a2c32fe050..bf75f7b2c2 100644
--- a/tools/libclang/CIndexHigh.cpp
+++ b/tools/libclang/CIndexHigh.cpp
@@ -21,8 +21,8 @@ using namespace cxcursor;
using namespace cxindex;
static void getTopOverriddenMethods(CXTranslationUnit TU,
- Decl *D,
- SmallVectorImpl<Decl *> &Methods) {
+ const Decl *D,
+ SmallVectorImpl<const Decl *> &Methods) {
if (!D)
return;
if (!isa<ObjCMethodDecl>(D) && !isa<CXXMethodDecl>(D))
@@ -46,15 +46,15 @@ namespace {
struct FindFileIdRefVisitData {
CXTranslationUnit TU;
FileID FID;
- Decl *Dcl;
+ const Decl *Dcl;
int SelectorIdIdx;
CXCursorAndRangeVisitor visitor;
- typedef SmallVector<Decl *, 8> TopMethodsTy;
+ typedef SmallVector<const Decl *, 8> TopMethodsTy;
TopMethodsTy TopMethods;
FindFileIdRefVisitData(CXTranslationUnit TU, FileID FID,
- Decl *D, int selectorIdIdx,
+ const Decl *D, int selectorIdIdx,
CXCursorAndRangeVisitor visitor)
: TU(TU), FID(FID), SelectorIdIdx(selectorIdIdx), visitor(visitor) {
Dcl = getCanonical(D);
@@ -76,24 +76,25 @@ struct FindFileIdRefVisitData {
///
/// we consider the canonical decl of the constructor decl to be the class
/// itself, so both 'C' can be highlighted.
- Decl *getCanonical(Decl *D) const {
+ const Decl *getCanonical(const Decl *D) const {
if (!D)
return 0;
D = D->getCanonicalDecl();
- if (ObjCImplDecl *ImplD = dyn_cast<ObjCImplDecl>(D)) {
+ if (const ObjCImplDecl *ImplD = dyn_cast<ObjCImplDecl>(D)) {
if (ImplD->getClassInterface())
return getCanonical(ImplD->getClassInterface());
- } else if (CXXConstructorDecl *CXXCtorD = dyn_cast<CXXConstructorDecl>(D)) {
+ } else if (const CXXConstructorDecl *CXXCtorD =
+ dyn_cast<CXXConstructorDecl>(D)) {
return getCanonical(CXXCtorD->getParent());
}
return D;
}
- bool isHit(Decl *D) const {
+ bool isHit(const Decl *D) const {
if (!D)
return false;
@@ -108,7 +109,7 @@ struct FindFileIdRefVisitData {
}
private:
- bool isOverriddingMethod(Decl *D) const {
+ bool isOverriddingMethod(const Decl *D) const {
if (std::find(TopMethods.begin(), TopMethods.end(), D) !=
TopMethods.end())
return true;
@@ -150,7 +151,7 @@ static enum CXChildVisitResult findFileIdRefVisit(CXCursor cursor,
if (!clang_isDeclaration(declCursor.kind))
return CXChildVisit_Recurse;
- Decl *D = cxcursor::getCursorDecl(declCursor);
+ const Decl *D = cxcursor::getCursorDecl(declCursor);
if (!D)
return CXChildVisit_Continue;
@@ -218,7 +219,7 @@ static void findIdRefsInFile(CXTranslationUnit TU, CXCursor declCursor,
SourceManager &SM = Unit->getSourceManager();
FileID FID = SM.translateFile(File);
- Decl *Dcl = cxcursor::getCursorDecl(declCursor);
+ const Decl *Dcl = cxcursor::getCursorDecl(declCursor);
if (!Dcl)
return;
@@ -226,7 +227,7 @@ static void findIdRefsInFile(CXTranslationUnit TU, CXCursor declCursor,
cxcursor::getSelectorIdentifierIndex(declCursor),
Visitor);
- if (DeclContext *DC = Dcl->getParentFunctionOrMethod()) {
+ if (const DeclContext *DC = Dcl->getParentFunctionOrMethod()) {
clang_visitChildren(cxcursor::MakeCXCursor(cast<Decl>(DC), TU),
findFileIdRefVisit, &data);
return;