Changes in directory llvm/include/llvm:
Argument.h updated: 1.12 -> 1.13 BasicBlock.h updated: 1.61 -> 1.62 Constant.h updated: 1.32 -> 1.33 Function.h updated: 1.67 -> 1.68 GlobalVariable.h updated: 1.37 -> 1.38 InlineAsm.h updated: 1.13 -> 1.14 Instruction.h updated: 1.75 -> 1.76 Module.h updated: 1.76 -> 1.77 Pass.h updated: 1.61 -> 1.62 Type.h updated: 1.95 -> 1.96 Value.h updated: 1.87 -> 1.88 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+16 -15) Argument.h | 3 +++ BasicBlock.h | 1 + Constant.h | 1 + Function.h | 1 + GlobalVariable.h | 1 + InlineAsm.h | 1 + Instruction.h | 1 + Module.h | 10 ++++------ Pass.h | 4 +--- Type.h | 4 +--- Value.h | 4 +--- 11 files changed, 16 insertions(+), 15 deletions(-) Index: llvm/include/llvm/Argument.h diff -u llvm/include/llvm/Argument.h:1.12 llvm/include/llvm/Argument.h:1.13 --- llvm/include/llvm/Argument.h:1.12 Mon Jun 5 11:29:06 2006 +++ llvm/include/llvm/Argument.h Sat Dec 16 23:15:12 2006 @@ -53,6 +53,9 @@ const Argument *getPrev() const { return Prev; } virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { + if (OS) print(*OS); + } /// classof - Methods for support type inquiry through isa, cast, and /// dyn_cast: Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.61 llvm/include/llvm/BasicBlock.h:1.62 --- llvm/include/llvm/BasicBlock.h:1.61 Sat Sep 30 17:20:34 2006 +++ llvm/include/llvm/BasicBlock.h Sat Dec 16 23:15:12 2006 @@ -152,6 +152,7 @@ InstListType &getInstList() { return InstList; } virtual void print(std::ostream &OS) const { print(OS, 0); } + void print(std::ostream *OS) const { if (OS) print(*OS); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// Methods for support type inquiry through isa, cast, and dyn_cast: Index: llvm/include/llvm/Constant.h diff -u llvm/include/llvm/Constant.h:1.32 llvm/include/llvm/Constant.h:1.33 --- llvm/include/llvm/Constant.h:1.32 Thu Oct 19 19:27:06 2006 +++ llvm/include/llvm/Constant.h Sat Dec 16 23:15:12 2006 @@ -54,6 +54,7 @@ virtual bool isNullValue() const = 0; virtual void print(std::ostream &O) const; + void print(std::ostream *O) const { if (O) print(*O); } /// canTrap - Return true if evaluation of this constant could trap. This is /// true for things like constant expressions that could divide by zero. Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.67 llvm/include/llvm/Function.h:1.68 --- llvm/include/llvm/Function.h:1.67 Tue Oct 25 12:58:00 2005 +++ llvm/include/llvm/Function.h Sat Dec 16 23:15:12 2006 @@ -194,6 +194,7 @@ bool arg_empty() const { return ArgumentList.empty(); } virtual void print(std::ostream &OS) const { print(OS, 0); } + void print(std::ostream *OS) const { if (OS) print(*OS); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// viewCFG - This function is meant for use from the debugger. You can just Index: llvm/include/llvm/GlobalVariable.h diff -u llvm/include/llvm/GlobalVariable.h:1.37 llvm/include/llvm/GlobalVariable.h:1.38 --- llvm/include/llvm/GlobalVariable.h:1.37 Sat Sep 30 16:31:26 2006 +++ llvm/include/llvm/GlobalVariable.h Sat Dec 16 23:15:12 2006 @@ -123,6 +123,7 @@ virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const GlobalVariable *) { return true; } Index: llvm/include/llvm/InlineAsm.h diff -u llvm/include/llvm/InlineAsm.h:1.13 llvm/include/llvm/InlineAsm.h:1.14 --- llvm/include/llvm/InlineAsm.h:1.13 Wed Jul 26 11:18:00 2006 +++ llvm/include/llvm/InlineAsm.h Sat Dec 16 23:15:12 2006 @@ -60,6 +60,7 @@ const std::string &getConstraintString() const { return Constraints; } virtual void print(std::ostream &O) const { print(O, 0); } + void print(std::ostream *O) const { if (O) print(*O); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// Verify - This static method can be used by the parser to check to see if Index: llvm/include/llvm/Instruction.h diff -u llvm/include/llvm/Instruction.h:1.75 llvm/include/llvm/Instruction.h:1.76 --- llvm/include/llvm/Instruction.h:1.75 Sun Nov 26 19:05:09 2006 +++ llvm/include/llvm/Instruction.h Sat Dec 16 23:15:12 2006 @@ -169,6 +169,7 @@ static bool isTrapping(unsigned op); virtual void print(std::ostream &OS) const { print(OS, 0); } + void print(std::ostream *OS) const { if (OS) print(*OS); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// Methods for support type inquiry through isa, cast, and dyn_cast: Index: llvm/include/llvm/Module.h diff -u llvm/include/llvm/Module.h:1.76 llvm/include/llvm/Module.h:1.77 --- llvm/include/llvm/Module.h:1.76 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Module.h Sat Dec 16 23:15:12 2006 @@ -295,15 +295,13 @@ /// @{ public: /// Print the module to an output stream - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream(), 0); - } void print(std::ostream &OS) const { print(OS, 0); } + void print(std::ostream *OS) const { if (OS) print(*OS); } /// Print the module to an output stream with AssemblyAnnotationWriter. - void print(OStream &OS, AssemblyAnnotationWriter *AAW) const { - if (OS.stream()) print(*OS.stream(), AAW); - } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; + void print(std::ostream *OS, AssemblyAnnotationWriter *AAW) const { + if (OS) print(*OS, AAW); + } /// Dump the module to std::cerr (for debugging). void dump() const; /// This function causes all the subinstructions to "let go" of all references Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.61 llvm/include/llvm/Pass.h:1.62 --- llvm/include/llvm/Pass.h:1.61 Wed Dec 13 15:13:31 2006 +++ llvm/include/llvm/Pass.h Sat Dec 16 23:15:12 2006 @@ -105,10 +105,8 @@ /// provide the Module* in case the analysis doesn't need it it can just be /// ignored. /// - void print(OStream &O, const Module *M) const { - if (O.stream()) print(*O.stream(), M); - } virtual void print(std::ostream &O, const Module *M) const; + void print(std::ostream *O, const Module *M) const { if (O) print(*O, M); } void dump() const; // dump - call print(std::cerr, 0); // Access AnalysisResolver_New Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.95 llvm/include/llvm/Type.h:1.96 --- llvm/include/llvm/Type.h:1.95 Fri Dec 8 12:06:14 2006 +++ llvm/include/llvm/Type.h Sat Dec 16 23:15:12 2006 @@ -141,10 +141,8 @@ /// mutable std::vector<AbstractTypeUser *> AbstractTypeUsers; public: - void print(OStream &O) const { - if (O.stream()) print(*O.stream()); - } void print(std::ostream &O) const; + void print(std::ostream *O) const { if (O) print(*O); } /// @brief Debugging support: print to stderr void dump() const; Index: llvm/include/llvm/Value.h diff -u llvm/include/llvm/Value.h:1.87 llvm/include/llvm/Value.h:1.88 --- llvm/include/llvm/Value.h:1.87 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Value.h Sat Dec 16 23:15:12 2006 @@ -75,10 +75,8 @@ /// print - Implement operator<< on Value... /// - void print(OStream &O) const { - if (O.stream()) print(*O.stream()); - } virtual void print(std::ostream &O) const = 0; + void print(std::ostream *O) const { if (O) print(*O); } /// All values are typed, get the type of this value. /// _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits