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
with_gc
|
Last change
on this file since a0d9f94 was 51b73452, checked in by Peter A. Buhr <pabuhr@…>, 11 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 |
|
|---|
| 20 | namespace SymTab {
|
|---|
| 21 |
|
|---|
| 22 | class TypeTableConflictFunction : public std::binary_function< NamedTypeDecl*, NamedTypeDecl*, NamedTypeDecl* >
|
|---|
| 23 | {
|
|---|
| 24 | public:
|
|---|
| 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 |
|
|---|
| 40 | typedef 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.