From: Gabor Greif Date: Thu, 17 Jun 2010 11:29:31 +0000 (+0000) Subject: fix some more gcc3.4 constness warnings X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=170e5080011acc60e33ec9b53f96c569a1078aa9;p=clang fix some more gcc3.4 constness warnings git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106216 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h index e043135f2f..08b2829f14 100644 --- a/include/clang/AST/TypeLoc.h +++ b/include/clang/AST/TypeLoc.h @@ -142,7 +142,7 @@ private: /// \brief Return the TypeLoc for a type source info. inline TypeLoc TypeSourceInfo::getTypeLoc() const { - return TypeLoc(Ty, (void*)(this + 1)); + return TypeLoc(Ty, const_cast(this + 1)); } /// \brief Wrapper of type source information for a type with diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h index ef5326909b..bd9b46869a 100644 --- a/include/clang/Lex/Token.h +++ b/include/clang/Lex/Token.h @@ -170,7 +170,7 @@ public: } void setLiteralData(const char *Ptr) { assert(isLiteral() && "Cannot set literal data of non-literal"); - PtrData = (void*)Ptr; + PtrData = const_cast(Ptr); } void *getAnnotationValue() const { diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 84f6f407cd..07b0c26403 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -2924,7 +2924,8 @@ Sema::OwningExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, ExprArg Base, // record types and dependent types matter. void *ObjectTypePtrForLookup = 0; if (!SS.isSet()) { - ObjectTypePtrForLookup = (void *)ObjectType->getAs(); + ObjectTypePtrForLookup = const_cast( + ObjectType->getAs()); if (!ObjectTypePtrForLookup && ObjectType->isDependentType()) ObjectTypePtrForLookup = Context.DependentTy.getAsOpaquePtr(); }