Changes in directory llvm/include/llvm/Analysis:
AliasSetTracker.h updated: 1.29 -> 1.30 CallGraph.h updated: 1.52 -> 1.53 Dominators.h updated: 1.62 -> 1.63 FindUsedTypes.h updated: 1.28 -> 1.29 Interval.h updated: 1.21 -> 1.22 IntervalPartition.h updated: 1.22 -> 1.23 LoopInfo.h updated: 1.62 -> 1.63 ScalarEvolution.h updated: 1.13 -> 1.14 ScalarEvolutionExpressions.h updated: 1.8 -> 1.9 Trace.h updated: 1.6 -> 1.7 --- 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: (+45 -40) AliasSetTracker.h | 16 ++-------------- CallGraph.h | 8 ++------ Dominators.h | 15 +++++++++++++++ FindUsedTypes.h | 1 + Interval.h | 1 + IntervalPartition.h | 3 +++ LoopInfo.h | 13 +++++++------ ScalarEvolution.h | 18 +++++------------- ScalarEvolutionExpressions.h | 7 +++++++ Trace.h | 3 ++- 10 files changed, 45 insertions(+), 40 deletions(-) Index: llvm/include/llvm/Analysis/AliasSetTracker.h diff -u llvm/include/llvm/Analysis/AliasSetTracker.h:1.29 llvm/include/llvm/Analysis/AliasSetTracker.h:1.30 --- llvm/include/llvm/Analysis/AliasSetTracker.h:1.29 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Analysis/AliasSetTracker.h Sat Dec 16 23:15:12 2006 @@ -156,10 +156,8 @@ iterator end() const { return iterator(); } bool empty() const { return PtrList == 0; } - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } void dump() const; /// Define an iterator for alias sets... this is just a forward iterator. @@ -248,10 +246,6 @@ bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const; }; -inline OStream& operator<<(OStream &OS, const AliasSet &AS) { - AS.print(OS); - return OS; -} inline std::ostream& operator<<(std::ostream &OS, const AliasSet &AS) { AS.print(OS); return OS; @@ -361,10 +355,8 @@ iterator begin() { return AliasSets.begin(); } iterator end() { return AliasSets.end(); } - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } void dump() const; private: @@ -390,10 +382,6 @@ AliasSet *findAliasSetForCallSite(CallSite CS); }; -inline OStream& operator<<(OStream &OS, const AliasSetTracker &AST) { - AST.print(OS); - return OS; -} inline std::ostream& operator<<(std::ostream &OS, const AliasSetTracker &AST) { AST.print(OS); return OS; Index: llvm/include/llvm/Analysis/CallGraph.h diff -u llvm/include/llvm/Analysis/CallGraph.h:1.52 llvm/include/llvm/Analysis/CallGraph.h:1.53 --- llvm/include/llvm/Analysis/CallGraph.h:1.52 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Analysis/CallGraph.h Sat Dec 16 23:15:12 2006 @@ -152,10 +152,8 @@ /// void initialize(Module &M); - 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; // stub - dummy function, just ignore it @@ -201,10 +199,8 @@ /// dump - Print out this call graph node. /// void dump() const; - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } //===--------------------------------------------------------------------- // Methods to keep a call graph up to date with a function that has been Index: llvm/include/llvm/Analysis/Dominators.h diff -u llvm/include/llvm/Analysis/Dominators.h:1.62 llvm/include/llvm/Analysis/Dominators.h:1.63 --- llvm/include/llvm/Analysis/Dominators.h:1.62 Sun Nov 5 13:31:28 2006 +++ llvm/include/llvm/Analysis/Dominators.h Sat Dec 16 23:15:12 2006 @@ -144,6 +144,9 @@ /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } }; //===------------------------------------- @@ -234,6 +237,9 @@ /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } /// dominates - Return true if A dominates B. This performs the special /// checks necessary if A and B are in the same basic block. @@ -410,6 +416,9 @@ /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } }; //===------------------------------------- @@ -546,6 +555,9 @@ /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } protected: /// getNode - return the (Post)DominatorTree node for the specified basic /// block. This is the same as using operator[] on this class. @@ -635,6 +647,9 @@ /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } }; Index: llvm/include/llvm/Analysis/FindUsedTypes.h diff -u llvm/include/llvm/Analysis/FindUsedTypes.h:1.28 llvm/include/llvm/Analysis/FindUsedTypes.h:1.29 --- llvm/include/llvm/Analysis/FindUsedTypes.h:1.28 Wed Jun 7 17:00:25 2006 +++ llvm/include/llvm/Analysis/FindUsedTypes.h Sat Dec 16 23:15:12 2006 @@ -34,6 +34,7 @@ /// symbol table from the module. /// void print(std::ostream &o, const Module *M) const; + void print(std::ostream *o, const Module *M) const { if (o) print(*o, M); } private: /// IncorporateType - Incorporate one type and all of its subtypes into the Index: llvm/include/llvm/Analysis/Interval.h diff -u llvm/include/llvm/Analysis/Interval.h:1.21 llvm/include/llvm/Analysis/Interval.h:1.22 --- llvm/include/llvm/Analysis/Interval.h:1.21 Wed Jul 27 00:53:43 2005 +++ llvm/include/llvm/Analysis/Interval.h Sat Dec 16 23:15:12 2006 @@ -99,6 +99,7 @@ /// print - Show contents in human readable format... void print(std::ostream &O) const; + void print(std::ostream *O) const { if (O) print(*O); } }; /// succ_begin/succ_end - define methods so that Intervals may be used Index: llvm/include/llvm/Analysis/IntervalPartition.h diff -u llvm/include/llvm/Analysis/IntervalPartition.h:1.22 llvm/include/llvm/Analysis/IntervalPartition.h:1.23 --- llvm/include/llvm/Analysis/IntervalPartition.h:1.22 Thu Apr 21 15:16:32 2005 +++ llvm/include/llvm/Analysis/IntervalPartition.h Sat Dec 16 23:15:12 2006 @@ -61,6 +61,9 @@ // print - Show contents in human readable format... virtual void print(std::ostream &O, const Module* = 0) const; + void print(std::ostream *O, const Module* M = 0) const { + if (O) print(*O, M); + } // getRootInterval() - Return the root interval that contains the starting // block of the function. Index: llvm/include/llvm/Analysis/LoopInfo.h diff -u llvm/include/llvm/Analysis/LoopInfo.h:1.62 llvm/include/llvm/Analysis/LoopInfo.h:1.63 --- llvm/include/llvm/Analysis/LoopInfo.h:1.62 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Analysis/LoopInfo.h Sat Dec 16 23:15:12 2006 @@ -217,10 +217,10 @@ /// the mapping in the LoopInfo class. void removeBlockFromLoop(BasicBlock *BB); - void print(OStream &O, unsigned Depth = 0) const { - if (O.stream()) print(*O.stream(), Depth); - } void print(std::ostream &O, unsigned Depth = 0) const; + void print(std::ostream *O, unsigned Depth = 0) const { + if (O) print(*O, Depth); + } void dump() const; private: friend class LoopInfo; @@ -283,10 +283,11 @@ virtual bool runOnFunction(Function &F); virtual void releaseMemory(); - void print(OStream &O, const Module* = 0) const { - if (O.stream()) print(*O.stream()); - } + void print(std::ostream &O, const Module* = 0) const; + void print(std::ostream *O, const Module* M = 0) const { + if (O) print(*O, M); + } virtual void getAnalysisUsage(AnalysisUsage &AU) const; Index: llvm/include/llvm/Analysis/ScalarEvolution.h diff -u llvm/include/llvm/Analysis/ScalarEvolution.h:1.13 llvm/include/llvm/Analysis/ScalarEvolution.h:1.14 --- llvm/include/llvm/Analysis/ScalarEvolution.h:1.13 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Analysis/ScalarEvolution.h Sat Dec 16 23:15:12 2006 @@ -97,20 +97,14 @@ /// print - Print out the internal representation of this scalar to the /// specified stream. This should really only be used for debugging /// purposes. - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } virtual void print(std::ostream &OS) const = 0; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// dump - This method is used for debugging. /// void dump() const; }; - inline OStream &operator<<(OStream &OS, const SCEV &S) { - S.print(OS); - return OS; - } inline std::ostream &operator<<(std::ostream &OS, const SCEV &S) { S.print(OS); return OS; @@ -128,10 +122,8 @@ virtual bool isLoopInvariant(const Loop *L) const; virtual const Type *getType() const; virtual bool hasComputableLoopEvolution(const Loop *L) const; - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } virtual SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym, const SCEVHandle &Conc) const; @@ -242,10 +234,10 @@ virtual bool runOnFunction(Function &F); virtual void releaseMemory(); virtual void getAnalysisUsage(AnalysisUsage &AU) const; - void print(OStream &OS, const Module* = 0) const { - if (OS.stream()) print(*OS.stream()); - } virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } }; } Index: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.8 llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.9 --- llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.8 Thu Oct 26 01:15:43 2006 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h Sat Dec 16 23:15:12 2006 @@ -62,6 +62,7 @@ } 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 SCEVConstant *S) { return true; } @@ -108,6 +109,7 @@ virtual ConstantRange getValueRange() const; 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 SCEVTruncateExpr *S) { return true; } @@ -154,6 +156,7 @@ } 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 SCEVZeroExtendExpr *S) { return true; } @@ -218,6 +221,7 @@ virtual const Type *getType() const { return getOperand(0)->getType(); } 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 SCEVCommutativeExpr *S) { return true; } @@ -332,6 +336,7 @@ virtual const Type *getType() const; 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 SCEVSDivExpr *S) { return true; } @@ -428,6 +433,7 @@ const SCEVHandle &Conc) const; 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 SCEVAddRecExpr *S) { return true; } @@ -472,6 +478,7 @@ virtual const Type *getType() const; 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 SCEVUnknown *S) { return true; } Index: llvm/include/llvm/Analysis/Trace.h diff -u llvm/include/llvm/Analysis/Trace.h:1.6 llvm/include/llvm/Analysis/Trace.h:1.7 --- llvm/include/llvm/Analysis/Trace.h:1.6 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Analysis/Trace.h Sat Dec 16 23:15:12 2006 @@ -106,7 +106,8 @@ /// print - Write trace to output stream. /// - void print (OStream &O) const; + void print (std::ostream &O) const; + void print (std::ostream *O) const { if (O) print(*O); } /// dump - Debugger convenience method; writes trace to standard error /// output stream. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits