source: src/ResolvExpr/AlternativePrinter.cc @ cc344be

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since cc344be was bff09c8, checked in by Rob Schluntz <rschlunt@…>, 7 years ago

Convert AlternativePrinter? to PassVisitor?

  • Property mode set to 100644
File size: 1.7 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 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// AlternativePrinter.cc --
8//
9// Author           : Richard C. Bilson
10// Created On       : Sun May 17 06:53:19 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sun May 17 06:55:05 2015
13// Update Count     : 2
14//
15
16#include "AlternativePrinter.h"
17
18#include <list>                          // for _List_const_iterator, list<>...
19
20#include "Alternative.h"                 // for AltList, Alternative
21#include "AlternativeFinder.h"           // for AlternativeFinder
22#include "ResolvExpr/TypeEnvironment.h"  // for TypeEnvironment
23#include "SynTree/Expression.h"          // for Expression
24#include "SynTree/Statement.h"           // for ExprStmt
25#include "SynTree/Type.h"                // for Type
26
27namespace ResolvExpr {
28        AlternativePrinter::AlternativePrinter( std::ostream &os ) : os( os ) {}
29
30        void AlternativePrinter::postvisit( ExprStmt *exprStmt ) {
31                TypeEnvironment env;
32                AlternativeFinder finder( indexer, env );
33                finder.findWithAdjustment( exprStmt->get_expr() );
34                int count = 1;
35                os << "There are " << finder.get_alternatives().size() << " alternatives" << std::endl;
36                for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
37                        os << "Alternative " << count++ << " ==============" << std::endl;
38                        i->expr->get_result()->print( os );
39                        //    i->print( os );
40                        os << std::endl;
41                } // for
42        } // AlternativePrinter::visit
43} // namespace ResolvExpr
44
45// Local Variables: //
46// tab-width: 4 //
47// mode: c++ //
48// compile-command: "make install" //
49// End: //
Note: See TracBrowser for help on using the repository browser.