source: translator/SymTab/TypeTable.h@ 6e952ec

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new string stuck-waitfor-destruct with_gc
Last change on this file since 6e952ec was 3c70d38, checked in by Peter A. Buhr <pabuhr@…>, 12 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.