From eade362f3062e4b2f492c755cc6f002bf15215c1 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 23 Jan 2013 08:25:41 +0000 Subject: [PATCH] Explicitly cast away the const-ness instead of doing it implicitly. llvm-svn: 173232 --- clang/tools/libclang/CIndex.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 5ec0fba1a83e..fa0bd524fb0a 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -130,9 +130,12 @@ CXSourceRange cxloc::translateSourceRange(const SourceManager &SM, EndLoc = EndLoc.getLocWithOffset(Length); } - CXSourceRange Result = { { (void *)&SM, (void *)&LangOpts }, - R.getBegin().getRawEncoding(), - EndLoc.getRawEncoding() }; + CXSourceRange Result = { + { static_cast(const_cast(&SM)), + static_cast(const_cast(&LangOpts)) }, + R.getBegin().getRawEncoding(), + EndLoc.getRawEncoding() + }; return Result; } @@ -4841,7 +4844,8 @@ static void getTokens(ASTUnit *CXXUnit, SourceRange Range, // - Kind-specific fields if (Tok.isLiteral()) { CXTok.int_data[0] = CXToken_Literal; - CXTok.ptr_data = (void *)Tok.getLiteralData(); + CXTok.ptr_data = + static_cast(const_cast(Tok.getLiteralData())); } else if (Tok.is(tok::raw_identifier)) { // Lookup the identifier to determine whether we have a keyword. IdentifierInfo *II @@ -5829,7 +5833,7 @@ CXFile clang_getIncludedFile(CXCursor cursor) { return 0; const InclusionDirective *ID = getCursorInclusionDirective(cursor); - return (void *)ID->getFile(); + return static_cast(const_cast(ID->getFile())); } CXSourceRange clang_Cursor_getCommentRange(CXCursor C) {