public:
ASTMaker(ASTContext &C) : C(C) {}
+ /// Create a new DeclRefExpr for the referenced variable.
DeclRefExpr *makeDeclRefExpr(const VarDecl *D);
+ /// Create an implicit cast for an integer conversion.
+ ImplicitCastExpr *makeIntegralCast(const Expr *Arg, QualType Ty);
+
private:
ASTContext &C;
};
return DR;
}
+ImplicitCastExpr *ASTMaker::makeIntegralCast(const Expr *Arg, QualType Ty) {
+ return ImplicitCastExpr::Create(C, Ty, CK_IntegralCast,
+ const_cast<Expr*>(Arg), 0, VK_RValue);
+}
+
//===----------------------------------------------------------------------===//
// Creation functions for faux ASTs.
//===----------------------------------------------------------------------===//
IntegerLiteral *IL =
IntegerLiteral::Create(C, llvm::APInt(C.getTypeSize(C.IntTy), (uint64_t) 1),
C.IntTy, SourceLocation());
- ICE = ImplicitCastExpr::Create(C, PredicateTy, CK_IntegralCast, IL, 0,
- VK_RValue);
+ ICE = M.makeIntegralCast(IL, PredicateTy);
DR = M.makeDeclRefExpr(Predicate);
ImplicitCastExpr *LValToRval =
ImplicitCastExpr::Create(C, PredicateQPtrTy, CK_LValueToRValue, DR,