Mercurial > projects > ldc
comparison gen/logger.h @ 994:18ad5601dff7
Use LLVM OStream wrapper instead of <iostream> in the logger.
llvm::OStream provides all std::ostream functionality (by holding a
std::ostream* internally), but
* doesn't include <iostream>, avoiding per-file overhead.
* allows the stream pointer to be null, and the (inlined) operators do nothing
when that's the case. (This also allows removal of the ofstream("/dev/null")
hack Logger used when disabled, which presumably wasn't very portable)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Thu, 26 Feb 2009 14:51:02 +0100 |
parents | 1700239cab2e |
children | e7f0c2b48047 |
comparison
equal
deleted
inserted
replaced
993:27956b440c0a | 994:18ad5601dff7 |
---|---|
1 #ifndef _llvmd_gen_logger_h_ | 1 #ifndef _llvmd_gen_logger_h_ |
2 #define _llvmd_gen_logger_h_ | 2 #define _llvmd_gen_logger_h_ |
3 | 3 |
4 #include <iostream> | 4 #include "llvm/Support/Streams.h" |
5 | 5 |
6 struct Loc; | 6 struct Loc; |
7 | 7 |
8 namespace Logger | 8 namespace Logger |
9 { | 9 { |
10 void indent(); | 10 void indent(); |
11 void undent(); | 11 void undent(); |
12 std::ostream& cout(); | 12 llvm::OStream cout(); |
13 void println(const char* fmt, ...); | 13 void println(const char* fmt, ...); |
14 void print(const char* fmt, ...); | 14 void print(const char* fmt, ...); |
15 void enable(); | 15 void enable(); |
16 void disable(); | 16 void disable(); |
17 bool enabled(); | 17 bool enabled(); |