return const_cast<APValue*>(this)->getFloat();
}
- APValue &getVectorElt(unsigned i) const {
+ APValue &getVectorElt(unsigned i) {
assert(isVector() && "Invalid accessor");
return ((Vec*)(char*)Data)->Elts[i];
}
+ const APValue &getVectorElt(unsigned i) const {
+ assert(isVector() && "Invalid accessor");
+ return ((const Vec*)(const char*)Data)->Elts[i];
+ }
unsigned getVectorLength() const {
assert(isVector() && "Invalid accessor");
- return ((Vec*)(void *)Data)->NumElts;
+ return ((const Vec*)(const void *)Data)->NumElts;
}
APSInt &getComplexIntReal() {
else if (isFloat())
setFloat(RHS.getFloat());
else if (isVector())
- setVector(((Vec*)(char*)RHS.Data)->Elts, RHS.getVectorLength());
+ setVector(((const Vec *)(const char *)RHS.Data)->Elts,
+ RHS.getVectorLength());
else if (isComplexInt())
setComplexInt(RHS.getComplexIntReal(), RHS.getComplexIntImag());
else if (isComplexFloat())
unsigned RHSNumProtocols = RHS->getNumProtocols();
if (RHSNumProtocols > 0) {
- ObjCProtocolDecl **RHSProtocols = (ObjCProtocolDecl **)RHS->qual_begin();
+ ObjCProtocolDecl **RHSProtocols =
+ const_cast<ObjCProtocolDecl **>(RHS->qual_begin());
for (unsigned i = 0; i < RHSNumProtocols; ++i)
if (InheritedProtocolSet.count(RHSProtocols[i]))
IntersectionOfProtocols.push_back(RHSProtocols[i]);
const ASTRecordLayout &Info = C.getASTRecordLayout(RD);
PrintOffset(OS, Offset, IndentLevel);
- OS << C.getTypeDeclType((CXXRecordDecl *)RD).getAsString();
+ OS << C.getTypeDeclType(const_cast<CXXRecordDecl *>(RD)).getAsString();
if (Description)
OS << ' ' << Description;
if (RD->isEmpty())
}
case nonloc::LazyCompoundValKind: {
const nonloc::LazyCompoundVal &C = *cast<nonloc::LazyCompoundVal>(this);
- os << "lazyCompoundVal{" << (void*) C.getStore() << ',' << C.getRegion()
+ os << "lazyCompoundVal{" << const_cast<void *>(C.getStore())
+ << ',' << C.getRegion()
<< '}';
break;
}
if (!IvarOffsetPointer) {
uint64_t Offset;
if (ObjCImplementationDecl *OID =
- CGM.getContext().getObjCImplementation((ObjCInterfaceDecl*)(ID)))
+ CGM.getContext().getObjCImplementation(
+ const_cast<ObjCInterfaceDecl *>(ID)))
Offset = ComputeIvarBaseOffset(CGM, OID, Ivar);
else
Offset = ComputeIvarBaseOffset(CGM, ID, Ivar);
void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) {
const ValueDecl *D = cast<ValueDecl>(GD.getDecl());
- PrettyStackTraceDecl CrashInfo((ValueDecl *)D, D->getLocation(),
+ PrettyStackTraceDecl CrashInfo(const_cast<ValueDecl *>(D), D->getLocation(),
Context.getSourceManager(),
"Generating code for declaration");
const driver::ArgStringList &CCArgs = Cmd->getArguments();
llvm::OwningPtr<CompilerInvocation> CI(new CompilerInvocation);
- CompilerInvocation::CreateFromArgs(*CI, (const char**) CCArgs.data(),
- (const char**) CCArgs.data()+CCArgs.size(),
+ CompilerInvocation::CreateFromArgs(*CI,
+ const_cast<const char **>(CCArgs.data()),
+ const_cast<const char **>(CCArgs.data()) +
+ CCArgs.size(),
*Diags);
// Override any files that need remapping
BackendArgs.push_back("-time-passes");
BackendArgs.push_back(0);
llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1,
- (char**) &BackendArgs[0]);
+ const_cast<char **>(&BackendArgs[0]));
std::string FeaturesStr;
if (TargetOpts.CPU.size() || TargetOpts.Features.size()) {
else if (vs80comntools)
vscomntools = vs80comntools;
if (vscomntools && *vscomntools) {
- char *p = (char*)strstr(vscomntools, "\\Common7\\Tools");
+ char *p = const_cast<char *>(strstr(vscomntools, "\\Common7\\Tools"));
if (p)
*p = '\0';
path = vscomntools;
if (getLangOptions().ObjC1 && T->isObjCInterfaceType()) {
const ObjCInterfaceType *OIT = T->getAs<ObjCInterfaceType>();
T = Context.getObjCObjectPointerType(T,
- (ObjCProtocolDecl **)OIT->qual_begin(),
+ const_cast<ObjCProtocolDecl **>(
+ OIT->qual_begin()),
OIT->getNumProtocols(),
DeclType.Ptr.TypeQuals);
break;
for (unsigned i = 0; i != NumArgs; ++i)
Args[i + 1] = Clang->getFrontendOpts().LLVMArgs[i].c_str();
Args[NumArgs + 1] = 0;
- llvm::cl::ParseCommandLineOptions(NumArgs + 1, (char**) Args);
+ llvm::cl::ParseCommandLineOptions(NumArgs + 1, const_cast<char **>(Args));
}
// Create the actual diagnostics engine.