Re: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp
On Dec 15, 2006, at 6:11 PM, Jeff Cohen wrote: I got it to work... I'll be committing shortly. I'm not sure what the problem was, but it seems to have something to do with resolving the overload of operator and almost certainly is a VC++ bug. It won't accept a forward declared type when it ought to. Nice, thanks again Jeff! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp
Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.40 - 1.41 MachineBasicBlock.cpp updated: 1.36 - 1.37 MachineInstr.cpp updated: 1.138 - 1.139 --- Log message: An even better unbreakage... --- Diffs of the changes: (+24 -0) LiveInterval.cpp |7 +++ MachineBasicBlock.cpp |5 + MachineInstr.cpp | 12 3 files changed, 24 insertions(+) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.40 llvm/lib/CodeGen/LiveInterval.cpp:1.41 --- llvm/lib/CodeGen/LiveInterval.cpp:1.40 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/LiveInterval.cpp Fri Dec 15 16:57:14 2006 @@ -24,6 +24,7 @@ #include llvm/Target/MRegisterInfo.h #include algorithm #include map +#include ostream using namespace llvm; // An example for liveAt(): @@ -509,3 +510,9 @@ void LiveInterval::dump() const { cerr *this \n; } + + +OStream llvm::operator(OStream os, const LiveRange LR) { + if (os.stream()) *os.stream() LR; + return os; +} Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.37 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 Thu Dec 7 14:28:15 2006 +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Fri Dec 15 16:57:14 2006 @@ -31,6 +31,11 @@ return OS; } +OStream llvm::operator(OStream OS, const MachineBasicBlock MBB) { + if (OS.stream()) *OS.stream() MBB; + return OS; +} + // MBBs start out as #-1. When a MBB is added to a MachineFunction, it // gets the next available unique MBB number. If it is removed from a // MachineFunction, it goes back to being #-1. Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.138 llvm/lib/CodeGen/MachineInstr.cpp:1.139 --- llvm/lib/CodeGen/MachineInstr.cpp:1.138 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/MachineInstr.cpp Fri Dec 15 16:57:14 2006 @@ -18,6 +18,7 @@ #include llvm/Target/MRegisterInfo.h #include llvm/Support/LeakDetector.h #include llvm/Support/Streams.h +#include ostream using namespace llvm; /// MachineInstr ctor - This constructor creates a dummy MachineInstr with @@ -363,3 +364,14 @@ return OS; } + +OStream llvm::operator(OStream os, const MachineInstr minstr) { + if (os.stream()) *os.stream() minstr; + return os; +} + +OStream llvm::operator(OStream os, const MachineOperand mop) { + if (os.stream()) *os.stream() mop; + return os; +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp
Hold on. If you make these non-inlined, then the only chance for the compiler to remove potentially dead code (when o.stream() == 0) is through link time optimizations. Because this is still compiled by GCC right now, this won't be done and debug outputs will still be in the code. That is, they won't output anything, but the call will still be there. -bw On Dec 15, 2006, at 2:57 PM, Jeff Cohen wrote: Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.40 - 1.41 MachineBasicBlock.cpp updated: 1.36 - 1.37 MachineInstr.cpp updated: 1.138 - 1.139 --- Log message: An even better unbreakage... --- Diffs of the changes: (+24 -0) LiveInterval.cpp |7 +++ MachineBasicBlock.cpp |5 + MachineInstr.cpp | 12 3 files changed, 24 insertions(+) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.40 llvm/lib/CodeGen/ LiveInterval.cpp:1.41 --- llvm/lib/CodeGen/LiveInterval.cpp:1.40Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/LiveInterval.cpp Fri Dec 15 16:57:14 2006 @@ -24,6 +24,7 @@ #include llvm/Target/MRegisterInfo.h #include algorithm #include map +#include ostream using namespace llvm; // An example for liveAt(): @@ -509,3 +510,9 @@ void LiveInterval::dump() const { cerr *this \n; } + + +OStream llvm::operator(OStream os, const LiveRange LR) { + if (os.stream()) *os.stream() LR; + return os; +} Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 llvm/lib/ CodeGen/MachineBasicBlock.cpp:1.37 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 Thu Dec 7 14:28:15 2006 +++ llvm/lib/CodeGen/MachineBasicBlock.cppFri Dec 15 16:57:14 2006 @@ -31,6 +31,11 @@ return OS; } +OStream llvm::operator(OStream OS, const MachineBasicBlock MBB) { + if (OS.stream()) *OS.stream() MBB; + return OS; +} + // MBBs start out as #-1. When a MBB is added to a MachineFunction, it // gets the next available unique MBB number. If it is removed from a // MachineFunction, it goes back to being #-1. Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.138 llvm/lib/CodeGen/ MachineInstr.cpp:1.139 --- llvm/lib/CodeGen/MachineInstr.cpp:1.138 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/MachineInstr.cpp Fri Dec 15 16:57:14 2006 @@ -18,6 +18,7 @@ #include llvm/Target/MRegisterInfo.h #include llvm/Support/LeakDetector.h #include llvm/Support/Streams.h +#include ostream using namespace llvm; /// MachineInstr ctor - This constructor creates a dummy MachineInstr with @@ -363,3 +364,14 @@ return OS; } + +OStream llvm::operator(OStream os, const MachineInstr minstr) { + if (os.stream()) *os.stream() minstr; + return os; +} + +OStream llvm::operator(OStream os, const MachineOperand mop) { + if (os.stream()) *os.stream() mop; + return os; +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp
Chris asked me to not include ostream from header files, and to move stuff out of the header files if possible to make it so. Bill Wendling wrote: Hold on. If you make these non-inlined, then the only chance for the compiler to remove potentially dead code (when o.stream() == 0) is through link time optimizations. Because this is still compiled by GCC right now, this won't be done and debug outputs will still be in the code. That is, they won't output anything, but the call will still be there. -bw On Dec 15, 2006, at 2:57 PM, Jeff Cohen wrote: Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.40 - 1.41 MachineBasicBlock.cpp updated: 1.36 - 1.37 MachineInstr.cpp updated: 1.138 - 1.139 --- Log message: An even better unbreakage... --- Diffs of the changes: (+24 -0) LiveInterval.cpp |7 +++ MachineBasicBlock.cpp |5 + MachineInstr.cpp | 12 3 files changed, 24 insertions(+) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.40 llvm/lib/CodeGen/LiveInterval.cpp:1.41 --- llvm/lib/CodeGen/LiveInterval.cpp:1.40Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/LiveInterval.cppFri Dec 15 16:57:14 2006 @@ -24,6 +24,7 @@ #include llvm/Target/MRegisterInfo.h #include algorithm #include map +#include ostream using namespace llvm; // An example for liveAt(): @@ -509,3 +510,9 @@ void LiveInterval::dump() const { cerr *this \n; } + + +OStream llvm::operator(OStream os, const LiveRange LR) { + if (os.stream()) *os.stream() LR; + return os; +} Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.37 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36Thu Dec 7 14:28:15 2006 +++ llvm/lib/CodeGen/MachineBasicBlock.cppFri Dec 15 16:57:14 2006 @@ -31,6 +31,11 @@ return OS; } +OStream llvm::operator(OStream OS, const MachineBasicBlock MBB) { + if (OS.stream()) *OS.stream() MBB; + return OS; +} + // MBBs start out as #-1. When a MBB is added to a MachineFunction, it // gets the next available unique MBB number. If it is removed from a // MachineFunction, it goes back to being #-1. Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.138 llvm/lib/CodeGen/MachineInstr.cpp:1.139 --- llvm/lib/CodeGen/MachineInstr.cpp:1.138Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/MachineInstr.cppFri Dec 15 16:57:14 2006 @@ -18,6 +18,7 @@ #include llvm/Target/MRegisterInfo.h #include llvm/Support/LeakDetector.h #include llvm/Support/Streams.h +#include ostream using namespace llvm; /// MachineInstr ctor - This constructor creates a dummy MachineInstr with @@ -363,3 +364,14 @@ return OS; } + +OStream llvm::operator(OStream os, const MachineInstr minstr) { + if (os.stream()) *os.stream() minstr; + return os; +} + +OStream llvm::operator(OStream os, const MachineOperand mop) { + if (os.stream()) *os.stream() mop; + return os; +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp
That's reasonable. So then a better solution would be to keep everything in the .h file, but change operator(OStream) to call the print() function directly. So something like this: #include iosfwd // ... OStream operator(OStream OS, const MachineBasicBlock MBB) { if (*OS.stream()) MBB-print(*OS.stream()); return OS; } I'm still working on a nice way of implementing something like this: template typename StreamTy class BaseStream { StreamTy *stream; public: operator StreamTy () { return *stream; } }; but I'm having problems figuring out the null stream semantics (right now, it uses stream = 0 as an indication that it's null). But the above hack should suffice in the meantime. -bw On Dec 15, 2006, at 3:16 PM, Jeff Cohen wrote: Chris asked me to not include ostream from header files, and to move stuff out of the header files if possible to make it so. Bill Wendling wrote: Hold on. If you make these non-inlined, then the only chance for the compiler to remove potentially dead code (when o.stream() == 0) is through link time optimizations. Because this is still compiled by GCC right now, this won't be done and debug outputs will still be in the code. That is, they won't output anything, but the call will still be there. -bw On Dec 15, 2006, at 2:57 PM, Jeff Cohen wrote: Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.40 - 1.41 MachineBasicBlock.cpp updated: 1.36 - 1.37 MachineInstr.cpp updated: 1.138 - 1.139 --- Log message: An even better unbreakage... --- Diffs of the changes: (+24 -0) LiveInterval.cpp |7 +++ MachineBasicBlock.cpp |5 + MachineInstr.cpp | 12 3 files changed, 24 insertions(+) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.40 llvm/lib/CodeGen/ LiveInterval.cpp:1.41 --- llvm/lib/CodeGen/LiveInterval.cpp:1.40Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/LiveInterval.cppFri Dec 15 16:57:14 2006 @@ -24,6 +24,7 @@ #include llvm/Target/MRegisterInfo.h #include algorithm #include map +#include ostream using namespace llvm; // An example for liveAt(): @@ -509,3 +510,9 @@ void LiveInterval::dump() const { cerr *this \n; } + + +OStream llvm::operator(OStream os, const LiveRange LR) { + if (os.stream()) *os.stream() LR; + return os; +} Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 llvm/lib/ CodeGen/MachineBasicBlock.cpp:1.37 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36Thu Dec 7 14:28:15 2006 +++ llvm/lib/CodeGen/MachineBasicBlock.cppFri Dec 15 16:57:14 2006 @@ -31,6 +31,11 @@ return OS; } +OStream llvm::operator(OStream OS, const MachineBasicBlock MBB) { + if (OS.stream()) *OS.stream() MBB; + return OS; +} + // MBBs start out as #-1. When a MBB is added to a MachineFunction, it // gets the next available unique MBB number. If it is removed from a // MachineFunction, it goes back to being #-1. Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.138 llvm/lib/CodeGen/ MachineInstr.cpp:1.139 --- llvm/lib/CodeGen/MachineInstr.cpp:1.138Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/MachineInstr.cppFri Dec 15 16:57:14 2006 @@ -18,6 +18,7 @@ #include llvm/Target/MRegisterInfo.h #include llvm/Support/LeakDetector.h #include llvm/Support/Streams.h +#include ostream using namespace llvm; /// MachineInstr ctor - This constructor creates a dummy MachineInstr with @@ -363,3 +364,14 @@ return OS; } + +OStream llvm::operator(OStream os, const MachineInstr minstr) { + if (os.stream()) *os.stream() minstr; + return os; +} + +OStream llvm::operator(OStream os, const MachineOperand mop) { + if (os.stream()) *os.stream() mop; + return os; +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp
On Dec 15, 2006, at 3:31 PM, Bill Wendling wrote: That's reasonable. So then a better solution would be to keep everything in the .h file, but change operator(OStream) to call the print() function directly. So something like this: #include iosfwd // ... OStream operator(OStream OS, const MachineBasicBlock MBB) { if (*OS.stream()) MBB-print(*OS.stream()); return OS; } I'm still working on a nice way of implementing something like this: template typename StreamTy class BaseStream { StreamTy *stream; public: operator StreamTy () { return *stream; } }; but I'm having problems figuring out the null stream semantics (right now, it uses stream = 0 as an indication that it's null). But the above hack should suffice in the meantime. This is better, nice catch Bill! -Chris -bw On Dec 15, 2006, at 3:16 PM, Jeff Cohen wrote: Chris asked me to not include ostream from header files, and to move stuff out of the header files if possible to make it so. Bill Wendling wrote: Hold on. If you make these non-inlined, then the only chance for the compiler to remove potentially dead code (when o.stream() == 0) is through link time optimizations. Because this is still compiled by GCC right now, this won't be done and debug outputs will still be in the code. That is, they won't output anything, but the call will still be there. -bw On Dec 15, 2006, at 2:57 PM, Jeff Cohen wrote: Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.40 - 1.41 MachineBasicBlock.cpp updated: 1.36 - 1.37 MachineInstr.cpp updated: 1.138 - 1.139 --- Log message: An even better unbreakage... --- Diffs of the changes: (+24 -0) LiveInterval.cpp |7 +++ MachineBasicBlock.cpp |5 + MachineInstr.cpp | 12 3 files changed, 24 insertions(+) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.40 llvm/lib/CodeGen/ LiveInterval.cpp:1.41 --- llvm/lib/CodeGen/LiveInterval.cpp:1.40Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/LiveInterval.cppFri Dec 15 16:57:14 2006 @@ -24,6 +24,7 @@ #include llvm/Target/MRegisterInfo.h #include algorithm #include map +#include ostream using namespace llvm; // An example for liveAt(): @@ -509,3 +510,9 @@ void LiveInterval::dump() const { cerr *this \n; } + + +OStream llvm::operator(OStream os, const LiveRange LR) { + if (os.stream()) *os.stream() LR; + return os; +} Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 llvm/lib/ CodeGen/MachineBasicBlock.cpp:1.37 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36Thu Dec 7 14:28:15 2006 +++ llvm/lib/CodeGen/MachineBasicBlock.cppFri Dec 15 16:57:14 2006 @@ -31,6 +31,11 @@ return OS; } +OStream llvm::operator(OStream OS, const MachineBasicBlock MBB) { + if (OS.stream()) *OS.stream() MBB; + return OS; +} + // MBBs start out as #-1. When a MBB is added to a MachineFunction, it // gets the next available unique MBB number. If it is removed from a // MachineFunction, it goes back to being #-1. Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.138 llvm/lib/CodeGen/ MachineInstr.cpp:1.139 --- llvm/lib/CodeGen/MachineInstr.cpp:1.138Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/MachineInstr.cppFri Dec 15 16:57:14 2006 @@ -18,6 +18,7 @@ #include llvm/Target/MRegisterInfo.h #include llvm/Support/LeakDetector.h #include llvm/Support/Streams.h +#include ostream using namespace llvm; /// MachineInstr ctor - This constructor creates a dummy MachineInstr with @@ -363,3 +364,14 @@ return OS; } + +OStream llvm::operator(OStream os, const MachineInstr minstr) { + if (os.stream()) *os.stream() minstr; + return os; +} + +OStream llvm::operator(OStream os, const MachineOperand mop) { + if (os.stream()) *os.stream() mop; + return os; +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp
I'll look into making this change. Part of the problem is that VC++ doesn't like *OS.stream() in a header file when ostream isn't included, even if the declaration of std::basic_ostream shouldn't be needed (but doesn't have a problem with it in a .cpp file, probably because it isn't inlined then). This would appear to be a bug, but it also constrains my options. I could also just undo the change and go back to including ostream in the header files. Gcc must be doing it implicitly anyway, as that's the only way some of that code can compile (which does need the declaration of std::basic_ostream). Bill Wendling wrote: That's reasonable. So then a better solution would be to keep everything in the .h file, but change operator(OStream) to call the print() function directly. So something like this: #include iosfwd // ... OStream operator(OStream OS, const MachineBasicBlock MBB) { if (*OS.stream()) MBB-print(*OS.stream()); return OS; } I'm still working on a nice way of implementing something like this: template typename StreamTy class BaseStream { StreamTy *stream; public: operator StreamTy () { return *stream; } }; but I'm having problems figuring out the null stream semantics (right now, it uses stream = 0 as an indication that it's null). But the above hack should suffice in the meantime. -bw ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp
On Dec 15, 2006, at 3:58 PM, Jeff Cohen wrote: I'll look into making this change. Part of the problem is that VC++ doesn't like *OS.stream() in a header file when ostream isn't included, even if the declaration of std::basic_ostream shouldn't be needed (but doesn't have a problem with it in a .cpp file, probably because it isn't inlined then). This would appear to be a bug, but it also constrains my options. I could also just undo the change and go back to including ostream in the header files. Gcc must be doing it implicitly anyway, as that's the only way some of that code can compile (which does need the declaration of std::basic_ostream). If *OS.stream() isn't working, it seems likely that LLVMStream.h isn't getting #included. Alternatively, perhaps iosfwd isn't? -Chris Bill Wendling wrote: That's reasonable. So then a better solution would be to keep everything in the .h file, but change operator(OStream) to call the print() function directly. So something like this: #include iosfwd // ... OStream operator(OStream OS, const MachineBasicBlock MBB) { if (*OS.stream()) MBB-print(*OS.stream()); return OS; } I'm still working on a nice way of implementing something like this: template typename StreamTy class BaseStream { StreamTy *stream; public: operator StreamTy () { return *stream; } }; but I'm having problems figuring out the null stream semantics (right now, it uses stream = 0 as an indication that it's null). But the above hack should suffice in the meantime. -bw ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp
I got it to work... I'll be committing shortly. I'm not sure what the problem was, but it seems to have something to do with resolving the overload of operator and almost certainly is a VC++ bug. It won't accept a forward declared type when it ought to. Chris Lattner wrote: On Dec 15, 2006, at 3:58 PM, Jeff Cohen wrote: I'll look into making this change. Part of the problem is that VC++ doesn't like *OS.stream() in a header file when ostream isn't included, even if the declaration of std::basic_ostream shouldn't be needed (but doesn't have a problem with it in a .cpp file, probably because it isn't inlined then). This would appear to be a bug, but it also constrains my options. I could also just undo the change and go back to including ostream in the header files. Gcc must be doing it implicitly anyway, as that's the only way some of that code can compile (which does need the declaration of std::basic_ostream). If *OS.stream() isn't working, it seems likely that LLVMStream.h isn't getting #included. Alternatively, perhaps iosfwd isn't? -Chris Bill Wendling wrote: That's reasonable. So then a better solution would be to keep everything in the .h file, but change operator(OStream) to call the print() function directly. So something like this: #include iosfwd // ... OStream operator(OStream OS, const MachineBasicBlock MBB) { if (*OS.stream()) MBB-print(*OS.stream()); return OS; } I'm still working on a nice way of implementing something like this: template typename StreamTy class BaseStream { StreamTy *stream; public: operator StreamTy () { return *stream; } }; but I'm having problems figuring out the null stream semantics (right now, it uses stream = 0 as an indication that it's null). But the above hack should suffice in the meantime. -bw ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits