ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
persistent-indexer
pthread-emulation
qualifiedEnum
Last change
on this file since 79eaeb7 was 85b2300, checked in by Rob Schluntz <rschlunt@…>, 7 years ago |
Minor code cleanup
|
-
Property mode
set to
100644
|
File size:
2.0 KB
|
Rev | Line | |
---|
[681c764] | 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 |
|
---|
[25ba999] | 26 | #define DEBUG
|
---|
[681c764] | 27 |
|
---|
[25ba999] | 28 | namespace Debug {
|
---|
| 29 | /// debug codegen a translation unit
|
---|
[85b2300] | 30 | static inline void codeGen( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label, __attribute__((unused)) LinkageSpec::Spec linkageFilter = LinkageSpec::Builtin ) {
|
---|
[25ba999] | 31 | #ifdef DEBUG
|
---|
| 32 | std::list< Declaration * > decls;
|
---|
[681c764] | 33 |
|
---|
[6470882] | 34 | filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), [linkageFilter]( Declaration * decl ) {
|
---|
| 35 | return ! (decl->linkage & linkageFilter);
|
---|
[25ba999] | 36 | });
|
---|
| 37 |
|
---|
| 38 | std::cerr << "======" << label << "======" << std::endl;
|
---|
[5f08961d] | 39 | CodeGen::generate(
|
---|
| 40 | decls,
|
---|
| 41 | std::cerr,
|
---|
| 42 | true /* doIntrinsics */,
|
---|
| 43 | true /* pretty */,
|
---|
| 44 | false /* generateC */,
|
---|
| 45 | false /* lineMarks */,
|
---|
| 46 | true /* printTypeExpr */
|
---|
| 47 | );
|
---|
[25ba999] | 48 | #endif
|
---|
| 49 | } // dump
|
---|
| 50 |
|
---|
[1bdd261] | 51 | static inline void treeDump( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label, __attribute__((unused)) LinkageSpec::Spec linkageFilter = LinkageSpec::Compiler ) {
|
---|
[25ba999] | 52 | #ifdef DEBUG
|
---|
| 53 | std::list< Declaration * > decls;
|
---|
| 54 |
|
---|
[6470882] | 55 | filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), [linkageFilter]( Declaration * decl ) {
|
---|
| 56 | return ! (decl->linkage & linkageFilter);
|
---|
[25ba999] | 57 | });
|
---|
| 58 |
|
---|
| 59 | std::cerr << "======" << label << "======" << std::endl;
|
---|
| 60 | printAll( decls, std::cerr );
|
---|
| 61 | #endif
|
---|
| 62 | } // dump
|
---|
| 63 | }
|
---|
[681c764] | 64 |
|
---|
| 65 | // Local Variables: //
|
---|
| 66 | // tab-width: 4 //
|
---|
| 67 | // mode: c++ //
|
---|
| 68 | // compile-command: "make install" //
|
---|
| 69 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.