diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-14 00:46:27 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-14 00:46:27 +0000 |
commit | 9c256e379e7ee5e3ac40e6e2cb51e557954a1483 (patch) | |
tree | bdff8fcc9fd8b5cf7390826279e6f93dfbf82a4b /clang | |
parent | 049a4ffcb89d80a6424df60cd780dc4877c2a2b2 (diff) | |
download | bcm5719-llvm-9c256e379e7ee5e3ac40e6e2cb51e557954a1483.tar.gz bcm5719-llvm-9c256e379e7ee5e3ac40e6e2cb51e557954a1483.zip |
libclang: remove a few const_casts
llvm-svn: 172373
Diffstat (limited to 'clang')
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 2 | ||||
-rw-r--r-- | clang/tools/libclang/CXCursor.cpp | 6 | ||||
-rw-r--r-- | clang/tools/libclang/CXCursor.h | 4 | ||||
-rw-r--r-- | clang/tools/libclang/IndexingContext.cpp | 5 |
4 files changed, 8 insertions, 9 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 33811d0fb70..7b271dcd502 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -4462,7 +4462,7 @@ CXCursor clang_getCursorDefinition(CXCursor C) { case Decl::CXXConversion: { const FunctionDecl *Def = 0; if (cast<FunctionDecl>(D)->getBody(Def)) - return MakeCXCursor(const_cast<FunctionDecl *>(Def), TU); + return MakeCXCursor(Def, TU); return clang_getNullCursor(); } diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index 7134dc41892..bdd06bd334e 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -53,7 +53,7 @@ static CXCursorKind GetCursorKind(const Attr *A) { return CXCursor_UnexposedAttr; } -CXCursor cxcursor::MakeCXCursor(const Attr *A, Decl *Parent, +CXCursor cxcursor::MakeCXCursor(const Attr *A, const Decl *Parent, CXTranslationUnit TU) { assert(A && Parent && TU && "Invalid arguments!"); CXCursor C = { GetCursorKind(A), 0, { Parent, A, TU } }; @@ -89,7 +89,7 @@ CXCursor cxcursor::MakeCXCursor(const Decl *D, CXTranslationUnit TU, return C; } -CXCursor cxcursor::MakeCXCursor(const Stmt *S, Decl *Parent, +CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent, CXTranslationUnit TU, SourceRange RegionOfInterest) { assert(S && TU && "Invalid arguments!"); @@ -830,7 +830,7 @@ void cxcursor::getOverriddenCursors(CXCursor cursor, for (SmallVector<const NamedDecl *, 8>::iterator I = OverDecls.begin(), E = OverDecls.end(); I != E; ++I) { - overridden.push_back(MakeCXCursor(const_cast<NamedDecl*>(*I), TU)); + overridden.push_back(MakeCXCursor(*I, TU)); } } diff --git a/clang/tools/libclang/CXCursor.h b/clang/tools/libclang/CXCursor.h index 79892f4d29f..880b6643d8a 100644 --- a/clang/tools/libclang/CXCursor.h +++ b/clang/tools/libclang/CXCursor.h @@ -48,12 +48,12 @@ namespace cxcursor { CXCursor getCursor(CXTranslationUnit, SourceLocation); -CXCursor MakeCXCursor(const clang::Attr *A, clang::Decl *Parent, +CXCursor MakeCXCursor(const clang::Attr *A, const clang::Decl *Parent, CXTranslationUnit TU); CXCursor MakeCXCursor(const clang::Decl *D, CXTranslationUnit TU, SourceRange RegionOfInterest = SourceRange(), bool FirstInDeclGroup = true); -CXCursor MakeCXCursor(const clang::Stmt *S, clang::Decl *Parent, +CXCursor MakeCXCursor(const clang::Stmt *S, const clang::Decl *Parent, CXTranslationUnit TU, SourceRange RegionOfInterest = SourceRange()); CXCursor MakeCXCursorInvalid(CXCursorKind K, CXTranslationUnit TU = 0); diff --git a/clang/tools/libclang/IndexingContext.cpp b/clang/tools/libclang/IndexingContext.cpp index 3a73aee59f0..43eeb44ef02 100644 --- a/clang/tools/libclang/IndexingContext.cpp +++ b/clang/tools/libclang/IndexingContext.cpp @@ -69,7 +69,7 @@ AttrListInfo::AttrListInfo(const Decl *D, IndexingContext &IdxCtx) for (AttrVec::const_iterator AttrI = D->attr_begin(), AttrE = D->attr_end(); AttrI != AttrE; ++AttrI) { const Attr *A = *AttrI; - CXCursor C = MakeCXCursor(A, const_cast<Decl *>(D), IdxCtx.CXTU); + CXCursor C = MakeCXCursor(A, D, IdxCtx.CXTU); CXIdxLoc Loc = IdxCtx.getIndexLoc(A->getLocation()); switch (C.kind) { default: @@ -644,8 +644,7 @@ bool IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc, if (!D) return false; - CXCursor Cursor = E ? MakeCXCursor(const_cast<Expr*>(E), - const_cast<Decl*>(cast<Decl>(DC)), CXTU) + CXCursor Cursor = E ? MakeCXCursor(E, cast<Decl>(DC), CXTU) : getRefCursor(D, Loc); return handleReference(D, Loc, Cursor, Parent, DC, E, Kind); } |