[cfe-commits] r44503 - in /cfe/trunk/CodeGen: CGBuiltin.cpp CGExpr.cpp CGExprAgg.cpp CGExprComplex.cpp CGExprScalar.cpp CGStmt.cpp CodeGenFunction.cpp CodeGenFunction.h

Chris Lattner sabre at nondot.org
Sat Dec 1 17:49:18 PST 2007


Author: lattner
Date: Sat Dec  1 19:49:16 2007
New Revision: 44503

URL: http://llvm.org/viewvc/llvm-project?rev=44503&view=rev
Log:
convert the rest of the stderr users in codegen to use diagnostics.

Modified:
    cfe/trunk/CodeGen/CGBuiltin.cpp
    cfe/trunk/CodeGen/CGExpr.cpp
    cfe/trunk/CodeGen/CGExprAgg.cpp
    cfe/trunk/CodeGen/CGExprComplex.cpp
    cfe/trunk/CodeGen/CGExprScalar.cpp
    cfe/trunk/CodeGen/CGStmt.cpp
    cfe/trunk/CodeGen/CodeGenFunction.cpp
    cfe/trunk/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGBuiltin.cpp?rev=44503&r1=44502&r2=44503&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/CodeGen/CGBuiltin.cpp Sat Dec  1 19:49:16 2007
@@ -29,8 +29,7 @@
     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()))

Modified: cfe/trunk/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExpr.cpp?rev=44503&r1=44502&r2=44503&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/CodeGen/CGExpr.cpp Sat Dec  1 19:49:16 2007
@@ -82,8 +82,7 @@
 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));
   }

Modified: cfe/trunk/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprAgg.cpp?rev=44503&r1=44502&r2=44503&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/CodeGen/CGExprAgg.cpp Sat Dec  1 19:49:16 2007
@@ -54,8 +54,7 @@
   //===--------------------------------------------------------------------===//
   
   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::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 @@
   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;
   }
 

Modified: cfe/trunk/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprComplex.cpp?rev=44503&r1=44502&r2=44503&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/CodeGen/CGExprComplex.cpp Sat Dec  1 19:49:16 2007
@@ -232,8 +232,7 @@
 //===----------------------------------------------------------------------===//
 
 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);

Modified: cfe/trunk/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprScalar.cpp?rev=44503&r1=44502&r2=44503&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/CodeGen/CGExprScalar.cpp Sat Dec  1 19:49:16 2007
@@ -396,8 +396,7 @@
 //===----------------------------------------------------------------------===//
 
 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()));

Modified: cfe/trunk/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGStmt.cpp?rev=44503&r1=44502&r2=44503&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/CodeGen/CGStmt.cpp Sat Dec  1 19:49:16 2007
@@ -38,7 +38,7 @@
       else
         EmitAggExpr(E, 0, false);
     } else {
-      WarnUnsupported(S);
+      WarnUnsupported(S, "statement");
     }
     break;
   case Stmt::NullStmtClass: break;

Modified: cfe/trunk/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenFunction.cpp?rev=44503&r1=44502&r2=44503&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/CodeGen/CodeGenFunction.cpp Sat Dec  1 19:49:16 2007
@@ -147,10 +147,11 @@
 
 /// 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);
 }
 

Modified: cfe/trunk/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenFunction.h?rev=44503&r1=44502&r2=44503&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/CodeGen/CodeGenFunction.h Sat Dec  1 19:49:16 2007
@@ -272,7 +272,7 @@
   
   /// 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





More information about the cfe-commits mailing list