if (getContext().BuiltinInfo.isLibFunction(BuiltinID))
return EmitCallExpr(CGM.getBuiltinLibFunction(BuiltinID), E);
- fprintf(stderr, "Unimplemented builtin!!\n");
- E->dump(getContext().SourceMgr);
+ WarnUnsupported(E, "builtin function");
// Unknown builtin, for now just dump it out and return undef.
if (hasAggregateLLVMType(E->getType()))
LValue CodeGenFunction::EmitLValue(const Expr *E) {
switch (E->getStmtClass()) {
default: {
- fprintf(stderr, "Unimplemented lvalue expr!\n");
- E->dump(getContext().SourceMgr);
+ WarnUnsupported(E, "l-value expression");
llvm::Type *Ty = llvm::PointerType::get(ConvertType(E->getType()));
return LValue::MakeAddr(llvm::UndefValue::get(Ty));
}
//===--------------------------------------------------------------------===//
void VisitStmt(Stmt *S) {
- fprintf(stderr, "Unimplemented agg expr!\n");
- S->dump(CGF.getContext().SourceMgr);
+ CGF.WarnUnsupported(S, "aggregate expression");
}
void VisitParenExpr(ParenExpr *PE) { Visit(PE->getSubExpr()); }
}
void AggExprEmitter::VisitBinaryOperator(const BinaryOperator *E) {
- fprintf(stderr, "Unimplemented aggregate binary expr!\n");
- E->dump(CGF.getContext().SourceMgr);
+ CGF.WarnUnsupported(E, "aggregate binary expression");
}
void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) {
unsigned NumInitElements = E->getNumInits();
if (!E->getType()->isArrayType()) {
- fprintf(stderr, "Unimplemented aggregate expr! ");
- fprintf(stderr, "Only Array initializers are implemneted\n");
- E->dump(CGF.getContext().SourceMgr);
+ CGF.WarnUnsupported(E, "aggregate init-list expression");
return;
}
//===----------------------------------------------------------------------===//
ComplexPairTy ComplexExprEmitter::VisitExpr(Expr *E) {
- fprintf(stderr, "Unimplemented complex expr!\n");
- E->dump(CGF.getContext().SourceMgr);
+ CGF.WarnUnsupported(E, "complex expression");
const llvm::Type *EltTy =
CGF.ConvertType(E->getType()->getAsComplexType()->getElementType());
llvm::Value *U = llvm::UndefValue::get(EltTy);
//===----------------------------------------------------------------------===//
Value *ScalarExprEmitter::VisitExpr(Expr *E) {
- fprintf(stderr, "Unimplemented scalar expr!\n");
- E->dump(CGF.getContext().SourceMgr);
+ CGF.WarnUnsupported(E, "scalar expression");
if (E->getType()->isVoidType())
return 0;
return llvm::UndefValue::get(CGF.ConvertType(E->getType()));
else
EmitAggExpr(E, 0, false);
} else {
- WarnUnsupported(S);
+ WarnUnsupported(S, "statement");
}
break;
case Stmt::NullStmtClass: break;
/// WarnUnsupported - Print out a warning that codegen doesn't support the
/// specified stmt yet.
-void CodeGenFunction::WarnUnsupported(const Stmt *S) {
+void CodeGenFunction::WarnUnsupported(const Stmt *S, const char *Type) {
unsigned DiagID = CGM.getDiags().getCustomDiagID(Diagnostic::Warning,
- "cannot codegen this yet");
+ "cannot codegen this %0 yet");
SourceRange Range = S->getSourceRange();
- CGM.getDiags().Report(S->getLocStart(), DiagID, 0, 0, &Range, 1);
+ std::string Msg = Type;
+ CGM.getDiags().Report(S->getLocStart(), DiagID, &Msg, 1, &Range, 1);
}
/// WarnUnsupported - Print out a warning that codegen doesn't support the
/// specified stmt yet.
- void WarnUnsupported(const Stmt *S);
+ void WarnUnsupported(const Stmt *S, const char *Type);
//===--------------------------------------------------------------------===//
// Helpers