Changeset 6470882


Ignore:
Timestamp:
Mar 19, 2018, 2:07:42 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, with_gc
Children:
ec6c040
Parents:
31cb252
git-author:
Rob Schluntz <rschlunt@…> (03/15/18 13:45:30)
git-committer:
Rob Schluntz <rschlunt@…> (03/19/18 14:07:42)
Message:

Generalize debug print functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/Debug.h

    r31cb252 r6470882  
    2828namespace Debug {
    2929        /// debug codegen a translation unit
    30         static inline void codeGen( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label ) {
     30        static inline void codeGen( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label, LinkageSpec::Spec linkageFilter = LinkageSpec::Compiler ) {
    3131        #ifdef DEBUG
    3232                std::list< Declaration * > decls;
    3333
    34                 filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), []( Declaration * decl ) {
    35                         return ! LinkageSpec::isBuiltin( decl->get_linkage() );
     34                filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), [linkageFilter]( Declaration * decl ) {
     35                        return ! (decl->linkage & linkageFilter);
    3636                });
    3737
    3838                std::cerr << "======" << label << "======" << std::endl;
    39                 CodeGen::generate( decls, std::cerr, false, true );
     39                CodeGen::generate( decls, std::cerr, true, true );
    4040        #endif
    4141        } // dump
    4242
    43         static inline void treeDump( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label ) {
     43        static inline void treeDump( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label, LinkageSpec::Spec linkageFilter = LinkageSpec::Compiler ) {
    4444        #ifdef DEBUG
    4545                std::list< Declaration * > decls;
    4646
    47                 filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), []( Declaration * decl ) {
    48                         return ! LinkageSpec::isBuiltin( decl->get_linkage() );
     47                filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), [linkageFilter]( Declaration * decl ) {
     48                        return ! (decl->linkage & linkageFilter);
    4949                });
    5050
Note: See TracChangeset for help on using the changeset viewer.