source: src/Common/Debug.h @ 681c764

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since 681c764 was 681c764, checked in by Rob Schluntz <rschlunt@…>, 4 years ago

Add translator debug utility header file

  • Property mode set to 100644
File size: 1.1 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// Debug.h --
8//
9// Author           : Rob Schluntz
10// Created On       : Fri Sep 1 11:09:14 2017
11// Last Modified By : Rob Schluntz
12// Last Modified On : Fri Sep 1 11:09:36 2017
13// Update Count     : 2
14//
15
16#pragma once
17
18#include <string>
19#include <list>
20#include <iostream>
21
22#include "CodeGen/Generate.h"
23#include "Parser/LinkageSpec.h"
24#include "SynTree/Declaration.h"
25
26/// debug codegen a translation unit
27static inline void debugCodeGen( const std::list< Declaration * > & translationUnit, const std::string & label ) {
28        std::list< Declaration * > decls;
29
30        filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), []( Declaration * decl ) {
31                return ! LinkageSpec::isBuiltin( decl->get_linkage() );
32        });
33
34        std::cerr << "======" << label << "======" << std::endl;
35        CodeGen::generate( decls, std::cerr, false, true );
36} // dump
37
38// Local Variables: //
39// tab-width: 4 //
40// mode: c++ //
41// compile-command: "make install" //
42// End: //
Note: See TracBrowser for help on using the repository browser.