]> granicus.if.org Git - clang/commitdiff
Use const_cast to make it obvious that it's just removing constness (and silence...
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 28 Oct 2011 13:37:11 +0000 (13:37 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 28 Oct 2011 13:37:11 +0000 (13:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143193 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndexUSRs.cpp
tools/libclang/IndexingContext.cpp

index 1219c2eea1976478b99855d9f83245b9ac1546b7..11b124c562762117645570bd7098ee4745726aac 100644 (file)
@@ -817,7 +817,7 @@ bool cxcursor::getDeclCursorUSR(const Decl *D, SmallVectorImpl<char> &Buf) {
 
   {
     USRGenerator UG(&D->getASTContext(), &Buf);
-    UG->Visit((Decl*)D);
+    UG->Visit(const_cast<Decl*>(D));
 
     if (UG->ignoreResults())
       return true;
index f295582b535f7a44405b96c0ee7fe601480e98da..0f00bac948ec531a229c8fe5e2c2f062ab633793 100644 (file)
@@ -397,9 +397,11 @@ void IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc,
   if (isNotFromSourceFile(D->getLocation()))
     return;
 
-  CXIdxEntityRefInfo Info = { E ? MakeCXCursor((Stmt*)E,
-                                               (Decl*)cast<Decl>(DC), CXTU)
-                                : getRefCursor(D, Loc),
+  CXCursor Cursor = E ? MakeCXCursor(const_cast<Expr*>(E),
+                                     const_cast<Decl*>(cast<Decl>(DC)), CXTU)
+                      : getRefCursor(D, Loc);
+
+  CXIdxEntityRefInfo Info = { Cursor,
                               getIndexLoc(Loc),
                               getIndexEntity(D),
                               getIndexEntity(Parent),