Changeset c0d00b6 for src/Common/Debug.h


Ignore:
Timestamp:
Nov 25, 2017, 3:22:18 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c6e2c18
Parents:
9d06142 (diff), 3de176d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/Debug.h

    r9d06142 rc0d00b6  
    2424#include "SynTree/Declaration.h"
    2525
    26 /// debug codegen a translation unit
    27 static inline void debugCodeGen( const std::list< Declaration * > & translationUnit, const std::string & label ) {
    28         std::list< Declaration * > decls;
     26#define DEBUG
    2927
    30         filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), []( Declaration * decl ) {
    31                 return ! LinkageSpec::isBuiltin( decl->get_linkage() );
    32         });
     28namespace Debug {
     29        /// debug codegen a translation unit
     30        static inline void codeGen( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label ) {
     31        #ifdef DEBUG
     32                std::list< Declaration * > decls;
    3333
    34         std::cerr << "======" << label << "======" << std::endl;
    35         CodeGen::generate( decls, std::cerr, false, true );
    36 } // dump
     34                filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), []( Declaration * decl ) {
     35                        return ! LinkageSpec::isBuiltin( decl->get_linkage() );
     36                });
     37
     38                std::cerr << "======" << label << "======" << std::endl;
     39                CodeGen::generate( decls, std::cerr, false, true );
     40        #endif
     41        } // dump
     42
     43        static inline void treeDump( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label ) {
     44        #ifdef DEBUG
     45                std::list< Declaration * > decls;
     46
     47                filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), []( Declaration * decl ) {
     48                        return ! LinkageSpec::isBuiltin( decl->get_linkage() );
     49                });
     50
     51                std::cerr << "======" << label << "======" << std::endl;
     52                printAll( decls, std::cerr );
     53        #endif
     54        } // dump
     55}
    3756
    3857// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.