[cfe-commits] [PATCH 1/2] Fix Casting

David Greene dag at cray.com
Tue Jan 8 13:49:24 PST 2013


Use const_cast<> to avoid a cast-away-const error.
---
 .../tools/clang/tools/libclang/IndexingContext.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/llvm/tools/clang/tools/libclang/IndexingContext.cpp b/llvm/tools/clang/tools/libclang/IndexingContext.cpp
index e0cf414..e4c33b6 100644
--- a/llvm/tools/clang/tools/libclang/IndexingContext.cpp
+++ b/llvm/tools/clang/tools/libclang/IndexingContext.cpp
@@ -868,7 +868,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;
 }
-- 
1.7.8.4




More information about the cfe-commits mailing list