aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/IndexingContext.cpp
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2013-01-15 22:09:51 +0000
committerDavid Greene <greened@obbligato.org>2013-01-15 22:09:51 +0000
commit041e6aab2f48574009aebfb41ffcb74d00758a1f (patch)
tree163a0f2cb5c1315d1214487eb8495ed2405ff7d5 /tools/libclang/IndexingContext.cpp
parent3cfa5324ef1c5f75fe5e142bef8050aaf2f03704 (diff)
Fix Casting
Use const_cast<> to avoid a cast-away-const error. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172565 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/IndexingContext.cpp')
-rw-r--r--tools/libclang/IndexingContext.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp
index 43eeb44ef0..2dea75714b 100644
--- a/tools/libclang/IndexingContext.cpp
+++ b/tools/libclang/IndexingContext.cpp
@@ -231,7 +231,9 @@ bool IndexingContext::shouldAbort() {
void IndexingContext::enteredMainFile(const FileEntry *File) {
if (File && CB.enteredMainFile) {
- CXIdxClientFile idxFile = CB.enteredMainFile(ClientData, (CXFile)File, 0);
+ CXIdxClientFile idxFile =
+ CB.enteredMainFile(ClientData,
+ static_cast<CXFile>(const_cast<FileEntry *>(File)), 0);
FileMap[File] = idxFile;
}
}
@@ -247,7 +249,8 @@ void IndexingContext::ppIncludedFile(SourceLocation hashLoc,
ScratchAlloc SA(*this);
CXIdxIncludedFileInfo Info = { getIndexLoc(hashLoc),
SA.toCStr(filename),
- (CXFile)File,
+ static_cast<CXFile>(
+ const_cast<FileEntry *>(File)),
isImport, isAngled, isModuleImport };
CXIdxClientFile idxFile = CB.ppIncludedFile(ClientData, &Info);
FileMap[File] = idxFile;
@@ -263,7 +266,8 @@ void IndexingContext::importedModule(const ImportDecl *ImportD) {
std::string ModuleName = Mod->getFullModuleName();
CXIdxImportedASTFileInfo Info = {
- (CXFile)Mod->getASTFile(),
+ static_cast<CXFile>(
+ const_cast<FileEntry *>(Mod->getASTFile())),
Mod,
getIndexLoc(ImportD->getLocation()),
ImportD->isImplicit()
@@ -277,7 +281,8 @@ void IndexingContext::importedPCH(const FileEntry *File) {
return;
CXIdxImportedASTFileInfo Info = {
- (CXFile)File,
+ static_cast<CXFile>(
+ const_cast<FileEntry *>(File)),
/*module=*/NULL,
getIndexLoc(SourceLocation()),
/*isImplicit=*/false
@@ -862,7 +867,7 @@ CXIdxLoc IndexingContext::getIndexLoc(SourceLocation Loc) const {
if (Loc.isInvalid())
return idxLoc;
- idxLoc.ptr_data[0] = (void*)this;
+ idxLoc.ptr_data[0] = const_cast<IndexingContext *>(this);
idxLoc.int_data = Loc.getRawEncoding();
return idxLoc;
}
@@ -888,7 +893,7 @@ void IndexingContext::translateLoc(SourceLocation Loc,
if (indexFile)
*indexFile = getIndexFile(FE);
if (file)
- *file = (void *)FE;
+ *file = const_cast<FileEntry *>(FE);
if (line)
*line = SM.getLineNumber(FID, FileOffset);
if (column)