[cfe-commits] r173232 - /cfe/trunk/tools/libclang/CIndex.cpp

Bill Wendling isanbard at gmail.com
Wed Jan 23 00:25:42 PST 2013


Author: void
Date: Wed Jan 23 02:25:41 2013
New Revision: 173232

URL: http://llvm.org/viewvc/llvm-project?rev=173232&view=rev
Log:
Explicitly cast away the const-ness instead of doing it implicitly.

Modified:
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=173232&r1=173231&r2=173232&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed Jan 23 02:25:41 2013
@@ -130,9 +130,12 @@
     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 @@
     //   - 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 @@
     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) {





More information about the cfe-commits mailing list