aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-23 08:25:41 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-23 08:25:41 +0000
commitccdfdd7937d74396ca1b3bb69ed2642a8ff4c712 (patch)
tree7ab07502919e73f85b83ca2702d51d4758185ec6
parent89530e45729d300b39c7332d2ad20c3ea476ab94 (diff)
Explicitly cast away the const-ness instead of doing it implicitly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173232 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/libclang/CIndex.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 5ec0fba1a8..fa0bd524fb 100644
--- a/tools/libclang/CIndex.cpp
+++ b/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<void*>(const_cast<SourceManager*>(&SM)),
+ static_cast<void*>(const_cast<LangOptions*>(&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<void*>(const_cast<char*>(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<void*>(const_cast<FileEntry*>(ID->getFile()));
}
CXSourceRange clang_Cursor_getCommentRange(CXCursor C) {