source: translator/SymTab/TypeTable.h @ 3c70d38

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 3c70d38 was 3c70d38, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

make routine static qualifier conditional, remove and reorder hoisted aggregate, format adjustment

  • Property mode set to 100644
File size: 797 bytes
Line 
1#ifndef SYMTAB_TYPETABLE_H
2#define SYMTAB_TYPETABLE_H
3
4#include <cassert>
5#include <map>
6#include <stack>
7#include <string>
8#include <functional>
9
10#include "StackTable.h"
11#include "SynTree/Declaration.h"
12
13namespace SymTab {
14    class TypeTableConflictFunction : public std::binary_function< NamedTypeDecl *, NamedTypeDecl *, NamedTypeDecl * > {
15      public:
16        NamedTypeDecl *operator()( NamedTypeDecl *existing, NamedTypeDecl *added ) {
17            if ( existing->get_base() == 0 ) {
18                return added;
19            } else if( added->get_base() == 0 ) {
20                return existing;
21            } else {
22                throw SemanticError( "redeclaration of ", added );
23            }
24            assert( false );
25            return 0;
26        }
27    };
28
29    typedef StackTable< NamedTypeDecl, TypeTableConflictFunction > TypeTable;
30} // SymTab
31
32#endif // SYMTAB_TYPETABLE_H
Note: See TracBrowser for help on using the repository browser.