diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-02 01:49:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-02 01:49:16 +0000 |
commit | dc4d280136d3301fcbf3c7b4b2782c8bd804342c (patch) | |
tree | b9735ff4a2d9934e19ff14ac0f91b50f0acdac2b | |
parent | dc5e8268292046114ffe02e48773572a91a310f1 (diff) |
convert the rest of the stderr users in codegen to use diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44503 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CodeGen/CGBuiltin.cpp | 3 | ||||
-rw-r--r-- | CodeGen/CGExpr.cpp | 3 | ||||
-rw-r--r-- | CodeGen/CGExprAgg.cpp | 10 | ||||
-rw-r--r-- | CodeGen/CGExprComplex.cpp | 3 | ||||
-rw-r--r-- | CodeGen/CGExprScalar.cpp | 3 | ||||
-rw-r--r-- | CodeGen/CGStmt.cpp | 2 | ||||
-rw-r--r-- | CodeGen/CodeGenFunction.cpp | 7 | ||||
-rw-r--r-- | CodeGen/CodeGenFunction.h | 2 |
8 files changed, 13 insertions, 20 deletions
diff --git a/CodeGen/CGBuiltin.cpp b/CodeGen/CGBuiltin.cpp index 52a41d8533..a1d5af19dd 100644 --- a/CodeGen/CGBuiltin.cpp +++ b/CodeGen/CGBuiltin.cpp @@ -29,8 +29,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { 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())) diff --git a/CodeGen/CGExpr.cpp b/CodeGen/CGExpr.cpp index a4aa6db7ba..93f3d71eaf 100644 --- a/CodeGen/CGExpr.cpp +++ b/CodeGen/CGExpr.cpp @@ -82,8 +82,7 @@ RValue CodeGenFunction::EmitAnyExpr(const Expr *E, llvm::Value *AggLoc, 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)); } diff --git a/CodeGen/CGExprAgg.cpp b/CodeGen/CGExprAgg.cpp index 7646081d54..b0e360f28e 100644 --- a/CodeGen/CGExprAgg.cpp +++ b/CodeGen/CGExprAgg.cpp @@ -54,8 +54,7 @@ public: //===--------------------------------------------------------------------===// 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()); } @@ -152,8 +151,7 @@ void AggExprEmitter::VisitStmtExpr(const StmtExpr *E) { } 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) { @@ -201,9 +199,7 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *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; } diff --git a/CodeGen/CGExprComplex.cpp b/CodeGen/CGExprComplex.cpp index 085e83762a..3368c2801d 100644 --- a/CodeGen/CGExprComplex.cpp +++ b/CodeGen/CGExprComplex.cpp @@ -232,8 +232,7 @@ void ComplexExprEmitter::EmitStoreOfComplex(ComplexPairTy Val, llvm::Value *Ptr, //===----------------------------------------------------------------------===// 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); diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp index 37389dcd44..ab61aac599 100644 --- a/CodeGen/CGExprScalar.cpp +++ b/CodeGen/CGExprScalar.cpp @@ -396,8 +396,7 @@ EmitComplexToScalarConversion(CodeGenFunction::ComplexPairTy Src, //===----------------------------------------------------------------------===// 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())); diff --git a/CodeGen/CGStmt.cpp b/CodeGen/CGStmt.cpp index 40cdcd351f..63fdf05538 100644 --- a/CodeGen/CGStmt.cpp +++ b/CodeGen/CGStmt.cpp @@ -38,7 +38,7 @@ void CodeGenFunction::EmitStmt(const Stmt *S) { else EmitAggExpr(E, 0, false); } else { - WarnUnsupported(S); + WarnUnsupported(S, "statement"); } break; case Stmt::NullStmtClass: break; diff --git a/CodeGen/CodeGenFunction.cpp b/CodeGen/CodeGenFunction.cpp index db5072be0b..0da5fcdaaa 100644 --- a/CodeGen/CodeGenFunction.cpp +++ b/CodeGen/CodeGenFunction.cpp @@ -147,10 +147,11 @@ const CGRecordLayout *CodeGenFunction::getCGRecordLayout(CodeGenTypes &CGT, /// 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); } diff --git a/CodeGen/CodeGenFunction.h b/CodeGen/CodeGenFunction.h index 2fd8063837..0c66b50ada 100644 --- a/CodeGen/CodeGenFunction.h +++ b/CodeGen/CodeGenFunction.h @@ -272,7 +272,7 @@ public: /// 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 |