[cfe-commits] r173241 - in /cfe/trunk/tools/libclang: CXCursor.cpp CXSourceLocation.cpp

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


Author: void
Date: Wed Jan 23 02:58:23 2013
New Revision: 173241

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

Modified:
    cfe/trunk/tools/libclang/CXCursor.cpp
    cfe/trunk/tools/libclang/CXSourceLocation.cpp

Modified: cfe/trunk/tools/libclang/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.cpp?rev=173241&r1=173240&r2=173241&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXCursor.cpp (original)
+++ cfe/trunk/tools/libclang/CXCursor.cpp Wed Jan 23 02:58:23 2013
@@ -778,7 +778,7 @@
 }
 
 Decl *cxcursor::getCursorDecl(CXCursor Cursor) {
-  return (Decl *)Cursor.data[0];
+  return static_cast<Decl*>(const_cast<void*>(Cursor.data[0]));
 }
 
 Expr *cxcursor::getCursorExpr(CXCursor Cursor) {
@@ -791,15 +791,15 @@
       Cursor.kind == CXCursor_ObjCClassRef)
     return 0;
 
-  return (Stmt *)Cursor.data[1];
+  return static_cast<Stmt*>(const_cast<void*>(Cursor.data[1]));
 }
 
 Attr *cxcursor::getCursorAttr(CXCursor Cursor) {
-  return (Attr *)Cursor.data[1];
+  return static_cast<Attr*>(const_cast<void*>(Cursor.data[1]));
 }
 
 Decl *cxcursor::getCursorParentDecl(CXCursor Cursor) {
-  return (Decl *)Cursor.data[0];
+  return static_cast<Decl*>(const_cast<void*>(Cursor.data[0]));
 }
 
 ASTContext &cxcursor::getCursorContext(CXCursor Cursor) {

Modified: cfe/trunk/tools/libclang/CXSourceLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXSourceLocation.cpp?rev=173241&r1=173240&r2=173241&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXSourceLocation.cpp (original)
+++ cfe/trunk/tools/libclang/CXSourceLocation.cpp Wed Jan 23 02:58:23 2013
@@ -346,7 +346,7 @@
     return createNullLocation(file, line, column, offset);
 
   if (file)
-    *file = (void *)SM.getFileEntryForID(FID);
+    *file = static_cast<void*>(const_cast<FileEntry*>(SM.getFileEntryForID(FID)));
   if (line)
     *line = SM.getLineNumber(FID, FileOffset);
   if (column)





More information about the cfe-commits mailing list