Mercurial > projects > ldc
view gen/logger.h @ 1482:d9c5f5a43403
Run `semantic3` on imported modules, and emit new symbols with
`available_externally` linkage. This allows the inliner to inline functions from
other modules while telling the code generator to ignore those functions (treat
them as declarations)
Still generates a few extra `TypeInfo`s and strings...
Disabled when generating debug info because I don't really understand it, and it
doesn't like this.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sun, 07 Jun 2009 16:00:13 +0200 |
parents | 229e02867307 |
children | 2292878925f4 |
line wrap: on
line source
#ifndef _llvmd_gen_logger_h_ #define _llvmd_gen_logger_h_ #include "llvm/Support/Streams.h" #ifndef IS_PRINTF # ifdef __GNUC__ # define IS_PRINTF(FMTARG) __attribute((__format__ (__printf__, (FMTARG), (FMTARG)+1) )) # else # define IS_PRINTF(FMTARG) # endif #endif struct Loc; namespace Logger { void indent(); void undent(); llvm::OStream cout(); void println(const char* fmt, ...) IS_PRINTF(1); void print(const char* fmt, ...) IS_PRINTF(1); void enable(); void disable(); bool enabled(); void attention(Loc loc, const char* fmt, ...) IS_PRINTF(2); struct LoggerScope { LoggerScope() { Logger::indent(); } ~LoggerScope() { Logger::undent(); } }; } #define LOG_SCOPE Logger::LoggerScope _logscope; #define IF_LOG if (Logger::enabled()) #endif