source: translator/SymTab/TypeTable.h @ 51b7345

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 51b7345 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 930 bytes
Line 
1/*
2 * This file is part of the Cforall project
3 *
4 * $Id: TypeTable.h,v 1.2 2005/08/29 20:14:18 rcbilson Exp $
5 *
6 */
7
8#ifndef SYMTAB_TYPETABLE_H
9#define SYMTAB_TYPETABLE_H
10
11#include <cassert>
12#include <map>
13#include <stack>
14#include <string>
15#include <functional>
16
17#include "StackTable.h"
18#include "SynTree/Declaration.h"
19
20namespace SymTab {
21
22class TypeTableConflictFunction : public std::binary_function< NamedTypeDecl*, NamedTypeDecl*, NamedTypeDecl* >
23{
24public:
25  NamedTypeDecl *operator()( NamedTypeDecl *existing, NamedTypeDecl *added )
26  {
27    if( existing->get_base() == 0 ) {
28      return added;
29    } else if( added->get_base() == 0 ) {
30      return existing;
31    } else {
32      throw SemanticError( "redeclaration of ", added );
33    }
34    assert( false );
35    return 0;
36  }
37 
38};
39
40typedef StackTable< NamedTypeDecl, TypeTableConflictFunction > TypeTable;
41
42} // namespace SymTab
43
44#endif /* #ifndef SYMTAB_TYPETABLE_H */
Note: See TracBrowser for help on using the repository browser.