| 1 | // | 
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2018 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 | // NoIdSymbolTable.hpp -- Special WithSymbolTable variant ast::Pass helper. | 
|---|
| 8 | // | 
|---|
| 9 | // Author           : Andrew Beach | 
|---|
| 10 | // Created On       : Thr Apr 21 11:57:00 2022 | 
|---|
| 11 | // Last Modified By : Andrew Beach | 
|---|
| 12 | // Last Modified On : Thr Apr 21 11:57:00 2022 | 
|---|
| 13 | // Update Count     : 0 | 
|---|
| 14 | // | 
|---|
| 15 |  | 
|---|
| 16 | #pragma once | 
|---|
| 17 |  | 
|---|
| 18 | #include "AST/SymbolTable.hpp" | 
|---|
| 19 |  | 
|---|
| 20 | namespace Validate { | 
|---|
| 21 |  | 
|---|
| 22 | // A SymbolTable that only has the operations used in the Translate Dimension | 
|---|
| 23 | // pass. More importantly, it doesn't have some methods that should no be | 
|---|
| 24 | // called by the Pass template (lookupId and addId). | 
|---|
| 25 | class NoIdSymbolTable { | 
|---|
| 26 | ast::SymbolTable base; | 
|---|
| 27 | public: | 
|---|
| 28 | #       define FORWARD_X( func, types_and_names, just_names ) \ | 
|---|
| 29 | inline auto func types_and_names -> decltype( base.func just_names ) { \ | 
|---|
| 30 | return base.func just_names ; \ | 
|---|
| 31 | } | 
|---|
| 32 | #       define FORWARD_0( func )         FORWARD_X( func, (),             () ) | 
|---|
| 33 | #       define FORWARD_1( func, type )   FORWARD_X( func, (type arg),     (arg) ) | 
|---|
| 34 | #       define FORWARD_2( func, t0, t1 ) FORWARD_X( func, (t0 a0, t1 a1), (a0, a1) ) | 
|---|
| 35 |  | 
|---|
| 36 | FORWARD_0( enterScope ) | 
|---|
| 37 | FORWARD_0( leaveScope ) | 
|---|
| 38 | FORWARD_1( lookupType  , const std::string & ) | 
|---|
| 39 | FORWARD_1( lookupStruct, const std::string & ) | 
|---|
| 40 | FORWARD_1( lookupEnum  , const std::string & ) | 
|---|
| 41 | FORWARD_1( lookupUnion , const std::string & ) | 
|---|
| 42 | FORWARD_1( lookupTrait , const std::string & ) | 
|---|
| 43 | FORWARD_1( addType  , const ast::NamedTypeDecl * ) | 
|---|
| 44 | FORWARD_1( addStruct, const ast::StructDecl *    ) | 
|---|
| 45 | FORWARD_1( addEnum  , const ast::EnumDecl *      ) | 
|---|
| 46 | FORWARD_1( addUnion , const ast::UnionDecl *     ) | 
|---|
| 47 | FORWARD_1( addTrait , const ast::TraitDecl *     ) | 
|---|
| 48 | FORWARD_1( addStruct, const std::string &        ) | 
|---|
| 49 | FORWARD_1( addUnion , const std::string &        ) | 
|---|
| 50 | FORWARD_2( addWith  , const std::vector< ast::ptr<ast::Expr> > &, const ast::Decl * ) | 
|---|
| 51 |  | 
|---|
| 52 | FORWARD_1( globalLookupType, const std::string & ) | 
|---|
| 53 |  | 
|---|
| 54 | #       undef FORWARD_2 | 
|---|
| 55 | #       undef FORWARD_1 | 
|---|
| 56 | #       undef FORWARD_0 | 
|---|
| 57 | #       undef FORWARD_X | 
|---|
| 58 | }; | 
|---|
| 59 |  | 
|---|
| 60 | struct WithNoIdSymbolTable { | 
|---|
| 61 | NoIdSymbolTable symtab; | 
|---|
| 62 | }; | 
|---|
| 63 |  | 
|---|
| 64 | } | 
|---|
| 65 |  | 
|---|
| 66 | // Local Variables: // | 
|---|
| 67 | // tab-width: 4 // | 
|---|
| 68 | // mode: c++ // | 
|---|
| 69 | // compile-command: "make install" // | 
|---|
| 70 | // End: // | 
|---|