From 22e978a736cb34291c15de07e5b31d395d08dee5 Mon Sep 17 00:00:00 2001
From: Bill Wendling
-DEBUG(std::cerr << "I am here!\n"); +DOUT << "I am here!\n";
-DEBUG(std::cerr << "No debug type\n"); +DOUT << "No debug type\n"; #undef DEBUG_TYPE #define DEBUG_TYPE "foo" -DEBUG(std::cerr << "'foo' debug type\n"); +DOUT << "'foo' debug type\n"; #undef DEBUG_TYPE #define DEBUG_TYPE "bar" -DEBUG(std::cerr << "'bar' debug type\n"); +DOUT << "'bar' debug type\n"; #undef DEBUG_TYPE #define DEBUG_TYPE "" -DEBUG(std::cerr << "No debug type (2)\n"); +DOUT << "No debug type (2)\n";
However, this isn't really the best way to print out the contents of a BasicBlock! Since the ostream operators are overloaded for virtually anything you'll care about, you could have just invoked the print routine on the -basic block itself: std::cerr << *blk << "\n";.
+basic block itself: llvm::cerr << *blk << "\n";. @@ -761,7 +761,7 @@ small example that shows how to dump all instructions in a function to the stand // F is a ptr to a Function instance for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) - std::cerr << *i << "\n"; + llvm::cerr << *i << "\n"; @@ -837,7 +837,7 @@ without actually obtaining it via iteration over some structure: void printNextInstruction(Instruction* inst) { BasicBlock::iterator it(inst); ++it; // After this line, it refers to the instruction after *inst - if (it != inst->getParent()->end()) std::cerr << *it << "\n"; + if (it != inst->getParent()->end()) llvm::cerr << *it << "\n"; } @@ -956,8 +956,8 @@ Function* F = ...; for (Value::use_iterator i = F->use_begin(), e = F->use_end(); i != e; ++i) if (Instruction *Inst = dyn_cast<Instruction>(*i)) { - std::cerr << "F is used in instruction:\n"; - std::cerr << *Inst << "\n"; + llvm::cerr << "F is used in instruction:\n"; + llvm::cerr << *Inst << "\n"; } -- cgit v1.2.3