ArrayType::Normal, 0);
// Pass &StringTokLocs[0], StringTokLocs.size() to factory!
- return Owned(new StringLiteral(Literal.GetString(), Literal.GetStringLength(),
+ return Owned(new (Context) StringLiteral(Literal.GetString(),
+ Literal.GetStringLength(),
Literal.AnyWide, StrTy,
StringToks[0].getLocation(),
StringToks[NumStringToks-1].getLocation()));
DeclRefExpr *Sema::BuildDeclRefExpr(NamedDecl *D, QualType Ty, SourceLocation Loc,
bool TypeDependent, bool ValueDependent,
const CXXScopeSpec *SS) {
- if (SS && !SS->isEmpty()) {
- void *Mem = Context.getAllocator().Allocate<QualifiedDeclRefExpr>();
- return new (Mem) QualifiedDeclRefExpr(D, Ty, Loc, TypeDependent,
+ if (SS && !SS->isEmpty())
+ return new (Context) QualifiedDeclRefExpr(D, Ty, Loc, TypeDependent,
ValueDependent, SS->getRange().getBegin());
- } else {
- void *Mem = Context.getAllocator().Allocate<DeclRefExpr>();
- return new (Mem) DeclRefExpr(D, Ty, Loc, TypeDependent, ValueDependent);
- }
+ else
+ return new (Context) DeclRefExpr(D, Ty, Loc, TypeDependent, ValueDependent);
}
/// getObjectForAnonymousRecordDecl - Retrieve the (unnamed) field or
// therefore, not part of another non-anonymous record).
delete BaseObjectExpr;
- BaseObjectExpr = new DeclRefExpr(BaseObject, BaseObject->getType(),
+ BaseObjectExpr = new (Context) DeclRefExpr(BaseObject,BaseObject->getType(),
SourceLocation());
ExtraQuals
= Context.getCanonicalType(BaseObject->getType()).getCVRQualifiers();
== Context.getCanonicalType(ThisType)) ||
IsDerivedFrom(ThisType, AnonFieldType)) {
// Our base object expression is "this".
- BaseObjectExpr = new CXXThisExpr(SourceLocation(),
+ BaseObjectExpr = new (Context) CXXThisExpr(SourceLocation(),
MD->getThisType(Context));
BaseObjectIsPointer = true;
}
= MemberType.getCVRQualifiers() | ExtraQuals;
MemberType = MemberType.getQualifiedType(combinedQualifiers);
}
- Result = new MemberExpr(Result, BaseObjectIsPointer, *FI,
- OpLoc, MemberType);
+ Result = new (Context) MemberExpr(Result, BaseObjectIsPointer, *FI,
+ OpLoc, MemberType);
BaseObjectIsPointer = false;
ExtraQuals = Context.getCanonicalType(MemberType).getCVRQualifiers();
OpLoc = SourceLocation();
// to represent this name. Then, if it turns out that none of the
// arguments are type-dependent, we'll force the resolution of the
// dependent name at that point.
- void *Mem = Context.getAllocator().Allocate<CXXDependentNameExpr>();
- return Owned(new (Mem) CXXDependentNameExpr(Name.getAsIdentifierInfo(),
- Context.DependentTy, Loc));
+ return Owned(new (Context) CXXDependentNameExpr(Name.getAsIdentifierInfo(),
+ Context.DependentTy, Loc));
}
// Could be enum-constant, value decl, instance variable, etc.
// this into Self->ivar, just return a BareIVarExpr or something.
IdentifierInfo &II = Context.Idents.get("self");
OwningExprResult SelfExpr = ActOnIdentifierExpr(S, Loc, II, false);
- ObjCIvarRefExpr *MRef = new ObjCIvarRefExpr(IV, IV->getType(), Loc,
- static_cast<Expr*>(SelfExpr.release()),
+ ObjCIvarRefExpr *MRef = new (Context) ObjCIvarRefExpr(IV, IV->getType(),
+ Loc, static_cast<Expr*>(SelfExpr.release()),
true, true);
Context.setFieldDecl(IFace, IV, MRef);
return Owned(MRef);
if (D == 0 && II->isStr("super")) {
QualType T = Context.getPointerType(Context.getObjCInterfaceType(
getCurMethodDecl()->getClassInterface()));
- return Owned(new ObjCSuperExpr(Loc, T));
+ return Owned(new (Context) ObjCSuperExpr(Loc, T));
}
}
if (D == 0) {
== Context.getCanonicalType(ThisType)) ||
IsDerivedFrom(ThisType, CtxType)) {
// Build the implicit member access expression.
- Expr *This = new CXXThisExpr(SourceLocation(),
+ Expr *This = new (Context) CXXThisExpr(SourceLocation(),
MD->getThisType(Context));
- return Owned(new MemberExpr(This, true, cast<NamedDecl>(D),
+ return Owned(new (Context) MemberExpr(This, true, cast<NamedDecl>(D),
SourceLocation(), MemberType));
}
}
//
if (CurBlock && ShouldSnapshotBlockValueReference(CurBlock, VD)) {
// The BlocksAttr indicates the variable is bound by-reference.
- void *Mem = Context.getAllocator().Allocate<BlockDeclRefExpr>();
if (VD->getAttr<BlocksAttr>())
- return Owned(new (Mem) BlockDeclRefExpr(VD,
+ return Owned(new (Context) BlockDeclRefExpr(VD,
VD->getType().getNonReferenceType(), Loc, true));
// Variable will be bound by-copy, make it const within the closure.
VD->getType().addConst();
- return Owned(new (Mem) BlockDeclRefExpr(VD,
+ return Owned(new (Context) BlockDeclRefExpr(VD,
VD->getType().getNonReferenceType(), Loc, false));
}
// If this reference is not in a block or if the referenced variable is
llvm::APInt LengthI(32, Length + 1);
QualType ResTy = Context.CharTy.getQualifiedType(QualType::Const);
ResTy = Context.getConstantArrayType(ResTy, LengthI, ArrayType::Normal, 0);
- return Owned(new PredefinedExpr(Loc, ResTy, IT));
+ return Owned(new (Context) PredefinedExpr(Loc, ResTy, IT));
}
Sema::OwningExprResult Sema::ActOnCharacterConstant(const Token &Tok) {
if (Tok.getLength() == 1) {
const char Val = PP.getSpelledCharacterAt(Tok.getLocation());
unsigned IntSize = Context.Target.getIntWidth();
- void *Mem = Context.getAllocator().Allocate<IntegerLiteral>();
- return Owned(new (Mem) IntegerLiteral(llvm::APInt(IntSize, Val-'0'),
+ return Owned(new (Context) IntegerLiteral(llvm::APInt(IntSize, Val-'0'),
Context.IntTy, Tok.getLocation()));
}
// If this is an imaginary literal, create the ImaginaryLiteral wrapper.
if (Literal.isImaginary)
- Res = new ImaginaryLiteral(Res, Context.getComplexType(Res->getType()));
+ Res = new (Context) ImaginaryLiteral(Res,
+ Context.getComplexType(Res->getType()));
return Owned(Res);
}
SourceLocation R, ExprArg Val) {
Expr *E = (Expr *)Val.release();
assert((E != 0) && "ActOnParenExpr() missing expr");
- void *Mem = Context.getAllocator().Allocate<ParenExpr>();
- return Owned(new (Mem) ParenExpr(L, R, E));
+ return Owned(new (Context) ParenExpr(L, R, E));
}
/// The UsualUnaryConversions() function is *not* called by this routine.
return ExprError();
// C99 6.5.3.4p4: the type (an unsigned integer type) is size_t.
- void *Mem = Context.getAllocator().Allocate<SizeOfAlignOfExpr>();
- return Owned(new (Mem) SizeOfAlignOfExpr(isSizeof, isType, TyOrEx,
+ return Owned(new (Context) SizeOfAlignOfExpr(isSizeof, isType, TyOrEx,
Context.getSizeType(), OpLoc,
Range.getEnd()));
}
// argument will have value zero.
Expr *Args[2] = {
Arg,
- new IntegerLiteral(llvm::APInt(Context.Target.getIntWidth(), 0,
- /*isSigned=*/true),
- Context.IntTy, SourceLocation())
+ new (Context) IntegerLiteral(llvm::APInt(Context.Target.getIntWidth(), 0,
+ /*isSigned=*/true), Context.IntTy, SourceLocation())
};
// Build the candidate set for overloading
ResultTy = ResultTy.getNonReferenceType();
// Build the actual expression node.
- void *Mem = Context.getAllocator().Allocate<DeclRefExpr>();
- Expr *FnExpr = new (Mem) DeclRefExpr(FnDecl, FnDecl->getType(),
+ Expr *FnExpr = new (Context) DeclRefExpr(FnDecl, FnDecl->getType(),
SourceLocation());
UsualUnaryConversions(FnExpr);
Input.release();
- Mem = Context.getAllocator().Allocate<CXXOperatorCallExpr>();
- return Owned(new (Mem) CXXOperatorCallExpr(FnExpr, Args, 2, ResultTy,
+ return Owned(new (Context)CXXOperatorCallExpr(FnExpr, Args, 2, ResultTy,
OpLoc));
} else {
// We matched a built-in operator. Convert the arguments, then
if (result.isNull())
return ExprError();
Input.release();
- return Owned(new UnaryOperator(Arg, Opc, result, OpLoc));
+ return Owned(new (Context) UnaryOperator(Arg, Opc, result, OpLoc));
}
Action::OwningExprResult
ResultTy = ResultTy.getNonReferenceType();
// Build the actual expression node.
- Expr *FnExpr = new DeclRefExpr(FnDecl, FnDecl->getType(),
+ Expr *FnExpr = new (Context) DeclRefExpr(FnDecl, FnDecl->getType(),
SourceLocation());
UsualUnaryConversions(FnExpr);
Base.release();
Idx.release();
- return Owned(new CXXOperatorCallExpr(FnExpr, Args, 2, ResultTy, LLoc));
+ return Owned(new (Context) CXXOperatorCallExpr(FnExpr, Args, 2,
+ ResultTy, LLoc));
} else {
// We matched a built-in operator. Convert the arguments, then
// break out so that we will build the appropriate built-in
Base.release();
Idx.release();
- return Owned(new ArraySubscriptExpr(LHSExp, RHSExp, ResultType, RLoc));
+ return Owned(new (Context) ArraySubscriptExpr(LHSExp, RHSExp,
+ ResultType, RLoc));
}
QualType Sema::
MemberType = MemberType.getQualifiedType(combinedQualifiers);
}
- return Owned(new MemberExpr(BaseExpr, OpKind == tok::arrow, FD,
- MemberLoc, MemberType));
+ return Owned(new (Context) MemberExpr(BaseExpr, OpKind == tok::arrow, FD,
+ MemberLoc, MemberType));
} else if (CXXClassVarDecl *Var = dyn_cast<CXXClassVarDecl>(MemberDecl))
- return Owned(new MemberExpr(BaseExpr, OpKind == tok::arrow,
+ return Owned(new (Context) MemberExpr(BaseExpr, OpKind == tok::arrow,
Var, MemberLoc,
Var->getType().getNonReferenceType()));
else if (FunctionDecl *MemberFn = dyn_cast<FunctionDecl>(MemberDecl))
- return Owned(new MemberExpr(BaseExpr, OpKind == tok::arrow, MemberFn,
- MemberLoc, MemberFn->getType()));
+ return Owned(new (Context) MemberExpr(BaseExpr, OpKind == tok::arrow,
+ MemberFn, MemberLoc, MemberFn->getType()));
else if (OverloadedFunctionDecl *Ovl
= dyn_cast<OverloadedFunctionDecl>(MemberDecl))
- return Owned(new MemberExpr(BaseExpr, OpKind == tok::arrow, Ovl,
+ return Owned(new (Context) MemberExpr(BaseExpr, OpKind == tok::arrow, Ovl,
MemberLoc, Context.OverloadTy));
else if (EnumConstantDecl *Enum = dyn_cast<EnumConstantDecl>(MemberDecl))
- return Owned(new MemberExpr(BaseExpr, OpKind == tok::arrow, Enum,
+ return Owned(new (Context) MemberExpr(BaseExpr, OpKind == tok::arrow, Enum,
MemberLoc, Enum->getType()));
else if (isa<TypeDecl>(MemberDecl))
return ExprError(Diag(MemberLoc,diag::err_typecheck_member_reference_type)
// (*Obj).ivar.
if (const ObjCInterfaceType *IFTy = BaseType->getAsObjCInterfaceType()) {
if (ObjCIvarDecl *IV = IFTy->getDecl()->lookupInstanceVariable(&Member)) {
- ObjCIvarRefExpr *MRef= new ObjCIvarRefExpr(IV, IV->getType(), MemberLoc,
- BaseExpr,
+ ObjCIvarRefExpr *MRef= new (Context) ObjCIvarRefExpr(IV, IV->getType(),
+ MemberLoc, BaseExpr,
OpKind == tok::arrow);
Context.setFieldDecl(IFTy->getDecl(), IV, MRef);
return Owned(MRef);
// Search for a declared property first.
if (ObjCPropertyDecl *PD = IFace->FindPropertyDeclaration(&Member))
- return Owned(new ObjCPropertyRefExpr(PD, PD->getType(),
+ return Owned(new (Context) ObjCPropertyRefExpr(PD, PD->getType(),
MemberLoc, BaseExpr));
// Check protocols on qualified interfaces.
for (ObjCInterfaceType::qual_iterator I = IFTy->qual_begin(),
E = IFTy->qual_end(); I != E; ++I)
if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(&Member))
- return Owned(new ObjCPropertyRefExpr(PD, PD->getType(),
+ return Owned(new (Context) ObjCPropertyRefExpr(PD, PD->getType(),
MemberLoc, BaseExpr));
// If that failed, look for an "implicit" property by seeing if the nullary
}
// FIXME: we must check that the setter has property type.
- return Owned(new ObjCKVCRefExpr(Getter, Getter->getResultType(), Setter,
- MemberLoc, BaseExpr));
+ return Owned(new (Context) ObjCKVCRefExpr(Getter, Getter->getResultType(),
+ Setter, MemberLoc, BaseExpr));
}
return ExprError(Diag(MemberLoc, diag::err_property_not_found)
for (ObjCQualifiedIdType::qual_iterator I = QIdTy->qual_begin(),
E = QIdTy->qual_end(); I != E; ++I) {
if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(&Member))
- return Owned(new ObjCPropertyRefExpr(PD, PD->getType(),
+ return Owned(new (Context) ObjCPropertyRefExpr(PD, PD->getType(),
MemberLoc, BaseExpr));
// Also must look for a getter name which uses property syntax.
Selector Sel = PP.getSelectorTable().getNullarySelector(&Member);
if (ObjCMethodDecl *OMD = (*I)->getInstanceMethod(Sel)) {
- return Owned(new ObjCMessageExpr(BaseExpr, Sel, OMD->getResultType(),
- OMD, OpLoc, MemberLoc, NULL, 0));
+ return Owned(new (Context) ObjCMessageExpr(BaseExpr, Sel,
+ OMD->getResultType(), OMD, OpLoc, MemberLoc, NULL, 0));
}
}
QualType ret = CheckExtVectorComponent(BaseType, OpLoc, Member, MemberLoc);
if (ret.isNull())
return ExprError();
- return Owned(new ExtVectorElementExpr(ret, BaseExpr, Member, MemberLoc));
+ return Owned(new (Context) ExtVectorElementExpr(ret, BaseExpr, Member,
+ MemberLoc));
}
return ExprError(Diag(MemberLoc,
return true;
} else
// We already type-checked the argument, so we know it works.
- Arg = new CXXDefaultArgExpr(FDecl->getParamDecl(i));
+ Arg = new (Context) CXXDefaultArgExpr(FDecl->getParamDecl(i));
QualType ArgType = Arg->getType();
Call->setArg(i, Arg);
// FIXME: Will need to cache the results of name lookup (including
// ADL) in Fn.
if (Dependent)
- return Owned(new CallExpr(Fn, Args, NumArgs,
- Context.DependentTy, RParenLoc));
+ return Owned(new (Context) CallExpr(Fn, Args, NumArgs,
+ Context.DependentTy, RParenLoc));
// Determine whether this is a call to an object (C++ [over.call.object]).
if (getLangOptions().CPlusPlus && Fn->getType()->isRecordType())
// Update Fn to refer to the actual function selected.
Expr *NewFn = 0;
if (QualifiedDeclRefExpr *QDRExpr = dyn_cast<QualifiedDeclRefExpr>(DRExpr))
- NewFn = new QualifiedDeclRefExpr(FDecl, FDecl->getType(),
+ NewFn = new (Context) QualifiedDeclRefExpr(FDecl, FDecl->getType(),
QDRExpr->getLocation(), false, false,
QDRExpr->getSourceRange().getBegin());
else
- NewFn = new DeclRefExpr(FDecl, FDecl->getType(),
- Fn->getSourceRange().getBegin());
+ NewFn = new (Context) DeclRefExpr(FDecl, FDecl->getType(),
+ Fn->getSourceRange().getBegin());
Fn->Destroy(Context);
Fn = NewFn;
}
// of arguments and function on error.
// FIXME: Except that llvm::OwningPtr uses delete, when it really must be
// Destroy(), or nothing gets cleaned up.
- llvm::OwningPtr<CallExpr> TheCall(new CallExpr(Fn, Args, NumArgs,
+ llvm::OwningPtr<CallExpr> TheCall(new (Context) CallExpr(Fn, Args, NumArgs,
Context.BoolTy, RParenLoc));
const FunctionType *FuncT;
return ExprError();
}
InitExpr.release();
- return Owned(new CompoundLiteralExpr(LParenLoc, literalType, literalExpr,
- isFileScope));
+ return Owned(new (Context) CompoundLiteralExpr(LParenLoc, literalType,
+ literalExpr, isFileScope));
}
Action::OwningExprResult
// Semantic analysis for initializers is done by ActOnDeclarator() and
// CheckInitializer() - it requires knowledge of the object being intialized.
- InitListExpr *E = new InitListExpr(LBraceLoc, InitList, NumInit, RBraceLoc,
- Designators.hasAnyDesignators());
+ InitListExpr *E = new (Context) InitListExpr(LBraceLoc, InitList, NumInit,
+ RBraceLoc, Designators.hasAnyDesignators());
E->setType(Context.VoidTy); // FIXME: just a place holder for now.
return Owned(E);
}
if (CheckCastTypes(SourceRange(LParenLoc, RParenLoc), castType, castExpr))
return ExprError();
- return Owned(new CStyleCastExpr(castType, castExpr, castType,
+ return Owned(new (Context) CStyleCastExpr(castType, castExpr, castType,
LParenLoc, RParenLoc));
}
Cond.release();
LHS.release();
RHS.release();
- return Owned(new ConditionalOperator(CondExpr, isLHSNull ? 0 : LHSExpr,
- RHSExpr, result));
+ return Owned(new (Context) ConditionalOperator(CondExpr,
+ isLHSNull ? 0 : LHSExpr,
+ RHSExpr, result));
}
}
if (ResultTy.isNull())
return ExprError();
- if (CompTy.isNull()) {
- void *Mem = Context.getAllocator().Allocate<BinaryOperator>();
- return Owned(new (Mem) BinaryOperator(lhs, rhs, Opc, ResultTy, OpLoc));
- } else {
- void *Mem = Context.getAllocator().Allocate<CompoundAssignOperator>();
- return Owned(new (Mem) CompoundAssignOperator(lhs, rhs, Opc, ResultTy,
+ if (CompTy.isNull())
+ return Owned(new (Context) BinaryOperator(lhs, rhs, Opc, ResultTy, OpLoc));
+ else
+ return Owned(new (Context) CompoundAssignOperator(lhs, rhs, Opc, ResultTy,
CompTy, OpLoc));
- }
}
// Binary Operators. 'Tok' is the token for the operator.
// FIXME: We'll need to perform some caching of the result of name
// lookup for operator+.
if (lhs->isTypeDependent() || rhs->isTypeDependent()) {
- if (Opc > BinaryOperator::Assign && Opc <= BinaryOperator::OrAssign) {
- void *Mem = Context.getAllocator().Allocate<CompoundAssignOperator>();
- return Owned(new (Mem) CompoundAssignOperator(lhs, rhs, Opc,
+ if (Opc > BinaryOperator::Assign && Opc <= BinaryOperator::OrAssign)
+ return Owned(new (Context) CompoundAssignOperator(lhs, rhs, Opc,
Context.DependentTy,
Context.DependentTy, TokLoc));
- } else {
- void *Mem = Context.getAllocator().Allocate<BinaryOperator>();
- return Owned(new (Mem) BinaryOperator(lhs, rhs, Opc, Context.DependentTy,
- TokLoc));
- }
+ else
+ return Owned(new (Context) BinaryOperator(lhs, rhs, Opc, Context.DependentTy,
+ TokLoc));
}
if (getLangOptions().CPlusPlus &&
ResultTy = ResultTy.getNonReferenceType();
// Build the actual expression node.
- Expr *FnExpr = new DeclRefExpr(FnDecl, FnDecl->getType(),
- SourceLocation());
+ Expr *FnExpr = new (Context) DeclRefExpr(FnDecl, FnDecl->getType(),
+ SourceLocation());
UsualUnaryConversions(FnExpr);
- return Owned(new CXXOperatorCallExpr(FnExpr, Args, 2, ResultTy,TokLoc));
+ return Owned(new (Context) CXXOperatorCallExpr(FnExpr, Args, 2,
+ ResultTy, TokLoc));
} else {
// We matched a built-in operator. Convert the arguments, then
// break out so that we will build the appropriate built-in
ResultTy = ResultTy.getNonReferenceType();
// Build the actual expression node.
- Expr *FnExpr = new DeclRefExpr(FnDecl, FnDecl->getType(),
- SourceLocation());
+ Expr *FnExpr = new (Context) DeclRefExpr(FnDecl, FnDecl->getType(),
+ SourceLocation());
UsualUnaryConversions(FnExpr);
input.release();
- return Owned(new CXXOperatorCallExpr(FnExpr, &Input, 1,
- ResultTy, OpLoc));
+ return Owned(new (Context) CXXOperatorCallExpr(FnExpr, &Input, 1,
+ ResultTy, OpLoc));
} else {
// We matched a built-in operator. Convert the arguments, then
// break out so that we will build the appropriate built-in
if (resultType.isNull())
return ExprError();
input.release();
- void *Mem = Context.getAllocator().Allocate<UnaryOperator>();
- return Owned(new (Mem) UnaryOperator(Input, Opc, resultType, OpLoc));
+ return Owned(new (Context) UnaryOperator(Input, Opc, resultType, OpLoc));
}
/// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
// If we haven't seen this label yet, create a forward reference. It
// will be validated and/or cleaned up in ActOnFinishFunctionBody.
if (LabelDecl == 0)
- LabelDecl = new LabelStmt(LabLoc, LabelII, 0);
+ LabelDecl = new (Context) LabelStmt(LabLoc, LabelII, 0);
// Create the AST node. The address of a label always has type 'void*'.
- return new AddrLabelExpr(OpLoc, LabLoc, LabelDecl,
- Context.getPointerType(Context.VoidTy));
+ return new (Context) AddrLabelExpr(OpLoc, LabLoc, LabelDecl,
+ Context.getPointerType(Context.VoidTy));
}
Sema::ExprResult Sema::ActOnStmtExpr(SourceLocation LPLoc, StmtTy *substmt,
Ty = LastExpr->getType();
}
- return new StmtExpr(Compound, Ty, LPLoc, RPLoc);
+ return new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc);
}
Sema::ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
// Otherwise, create a compound literal expression as the base, and
// iteratively process the offsetof designators.
- Expr *Res = new CompoundLiteralExpr(SourceLocation(), ArgTy, 0, false);
+ Expr *Res = new (Context) CompoundLiteralExpr(SourceLocation(), ArgTy, 0,
+ false);
// offsetof with non-identifier designators (e.g. "offsetof(x, a.b[c])") are a
// GCC extension, diagnose them.
return Diag(Idx->getLocStart(), diag::err_typecheck_subscript)
<< Idx->getSourceRange();
- Res = new ArraySubscriptExpr(Res, Idx, AT->getElementType(), OC.LocEnd);
+ Res = new (Context) ArraySubscriptExpr(Res, Idx, AT->getElementType(),
+ OC.LocEnd);
continue;
}
// FIXME: Verify that MemberDecl isn't a bitfield.
// MemberDecl->getType() doesn't get the right qualifiers, but it doesn't
// matter here.
- Res = new MemberExpr(Res, false, MemberDecl, OC.LocEnd,
- MemberDecl->getType().getNonReferenceType());
+ Res = new (Context) MemberExpr(Res, false, MemberDecl, OC.LocEnd,
+ MemberDecl->getType().getNonReferenceType());
}
- return new UnaryOperator(Res, UnaryOperator::OffsetOf, Context.getSizeType(),
- BuiltinLoc);
+ return new (Context) UnaryOperator(Res, UnaryOperator::OffsetOf,
+ Context.getSizeType(), BuiltinLoc);
}
assert((!argT1.isNull() && !argT2.isNull()) && "Missing type argument(s)");
- return new TypesCompatibleExpr(Context.IntTy, BuiltinLoc, argT1, argT2,RPLoc);
+ return new (Context) TypesCompatibleExpr(Context.IntTy, BuiltinLoc, argT1,
+ argT2, RPLoc);
}
Sema::ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc, ExprTy *cond,
// If the condition is > zero, then the AST type is the same as the LSHExpr.
QualType resType = condEval.getZExtValue() ? LHSExpr->getType() :
RHSExpr->getType();
- return new ChooseExpr(BuiltinLoc, CondExpr, LHSExpr, RHSExpr, resType, RPLoc);
+ return new (Context) ChooseExpr(BuiltinLoc, CondExpr, LHSExpr, RHSExpr,
+ resType, RPLoc);
}
//===----------------------------------------------------------------------===//
BlockTy = Context.getBlockPointerType(BlockTy);
BSI->TheDecl->setBody(Body.take());
- return new BlockExpr(BSI->TheDecl, BlockTy);
+ return new (Context) BlockExpr(BSI->TheDecl, BlockTy);
}
/// ExprsMatchFnType - return true if the Exprs in array Args have
<< OE->getFn()->getSourceRange();
// Remember our match, and continue processing the remaining arguments
// to catch any errors.
- OE = new OverloadExpr(Args, NumArgs, i,
+ OE = new (Context) OverloadExpr(Args, NumArgs, i,
FnType->getResultType().getNonReferenceType(),
BuiltinLoc, RParenLoc);
}
// FIXME: Warn if a non-POD type is passed in.
- return new VAArgExpr(BuiltinLoc, E, T.getNonReferenceType(), RPLoc);
+ return new (Context) VAArgExpr(BuiltinLoc, E, T.getNonReferenceType(), RPLoc);
}
Sema::ExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) {
else
Ty = Context.LongTy;
- return new GNUNullExpr(Ty, TokenLoc);
+ return new (Context) GNUNullExpr(Ty, TokenLoc);
}
bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,