ADTast-experimentalenumpthread-emulationqualifiedEnum
Rev | Line | |
---|
[1622af5] | 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 | // CandidatePrinter.cpp -- Print expression canditates. |
---|
| 8 | // |
---|
| 9 | // Author : Andrew Beach |
---|
| 10 | // Created On : Tue Nov 9 9:54:00 2021 |
---|
| 11 | // Last Modified By : Andrew Beach |
---|
| 12 | // Last Modified On : Tue Nov 9 15:47:00 2021 |
---|
| 13 | // Update Count : 0 |
---|
| 14 | // |
---|
| 15 | |
---|
| 16 | #include "CandidatePrinter.hpp" |
---|
| 17 | |
---|
| 18 | #include "AST/Expr.hpp" |
---|
| 19 | #include "AST/Pass.hpp" |
---|
| 20 | #include "AST/Print.hpp" |
---|
| 21 | #include "AST/Stmt.hpp" |
---|
| 22 | #include "AST/TranslationUnit.hpp" |
---|
| 23 | #include "ResolvExpr/CandidateFinder.hpp" |
---|
| 24 | |
---|
| 25 | #include <iostream> |
---|
| 26 | |
---|
| 27 | namespace ResolvExpr { |
---|
| 28 | |
---|
| 29 | namespace { |
---|
| 30 | |
---|
| 31 | class CandidatePrintCore : public ast::WithSymbolTable { |
---|
| 32 | std::ostream & os; |
---|
| 33 | public: |
---|
| 34 | CandidatePrintCore( std::ostream & os ) : os( os ) {} |
---|
| 35 | |
---|
| 36 | void postvisit( const ast::ExprStmt * stmt ) { |
---|
| 37 | ast::TypeEnvironment env; |
---|
| 38 | CandidateFinder finder( symtab, env ); |
---|
| 39 | finder.find( stmt->expr, ResolvMode::withAdjustment() ); |
---|
| 40 | int count = 1; |
---|
| 41 | os << "There are " << finder.candidates.size() << " candidates\n"; |
---|
| 42 | for ( const std::shared_ptr<Candidate> & cand : finder ) { |
---|
| 43 | os << "Candidate " << count++ << " ==============\n"; |
---|
| 44 | ast::print( os, cand->expr->result.get() ); |
---|
| 45 | os << std::endl; |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | }; |
---|
| 49 | |
---|
| 50 | } // namespace |
---|
| 51 | |
---|
| 52 | void printCandidates( ast::TranslationUnit & transUnit ) { |
---|
| 53 | ast::Pass<CandidatePrintCore>::run( transUnit, std::cout ); |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | } // namespace ResolvExpr |
---|
| 57 | |
---|
| 58 | // Local Variables: // |
---|
| 59 | // tab-width: 4 // |
---|
| 60 | // mode: c++ // |
---|
| 61 | // compile-command: "make install" // |
---|
| 62 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.