Changeset 0dd3a2f for translator/SynTree/Declaration.cc
- Timestamp:
- May 18, 2015, 11:20:23 AM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 51587aa
- Parents:
- a32b204
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/SynTree/Declaration.cc
ra32b204 r0dd3a2f 1 /* 2 * This file is part of the Cforall project 3 * 4 * $Id: Declaration.cc,v 1.8 2005/08/29 20:59:25 rcbilson Exp $ 5 * 6 */ 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 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 // Declaration.cc -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 08:18:35 2015 13 // Update Count : 2 14 // 7 15 8 16 #include <string> … … 14 22 #include "utility.h" 15 23 16 17 24 const char* Declaration::storageClassName[] = { "", "auto", "static", "extern", "register" }; 18 25 … … 22 29 23 30 Declaration::Declaration( const std::string &name, StorageClass sc, LinkageSpec::Type linkage ) 24 : name( name ), storageClass( sc ), linkage( linkage ), uniqueId( 0 ) 25 { 31 : name( name ), storageClass( sc ), linkage( linkage ), uniqueId( 0 ) { 26 32 } 27 33 28 34 Declaration::Declaration( const Declaration &other ) 29 : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), uniqueId( other.uniqueId ) 30 { 35 : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), uniqueId( other.uniqueId ) { 31 36 } 32 37 33 Declaration::~Declaration() 34 { 38 Declaration::~Declaration() { 35 39 } 36 40 37 void 38 Declaration::fixUniqueId() 39 { 40 uniqueId = ++lastUniqueId; 41 idMap[ uniqueId ] = this; 41 void Declaration::fixUniqueId() { 42 uniqueId = ++lastUniqueId; 43 idMap[ uniqueId ] = this; 42 44 } 43 45 44 46 /* static class method */ 45 Declaration * 46 Declaration::declFromId( UniqueId id ) 47 { 48 IdMapType::const_iterator i = idMap.find( id ); 49 if ( i != idMap.end() ) { 50 return i->second; 51 } else { 52 return 0; 53 } 47 Declaration *Declaration::declFromId( UniqueId id ) { 48 IdMapType::const_iterator i = idMap.find( id ); 49 if ( i != idMap.end() ) { 50 return i->second; 51 } else { 52 return 0; 53 } // if 54 54 } 55 55 56 56 /* static class method */ 57 void 58 Declaration::dumpIds( std::ostream &os ) 59 { 60 for ( IdMapType::const_iterator i = idMap.begin(); i != idMap.end(); ++i ) { 61 os << i->first << " -> "; 62 i->second->printShort( os ); 63 os << std::endl; 64 } 57 void Declaration::dumpIds( std::ostream &os ) { 58 for ( IdMapType::const_iterator i = idMap.begin(); i != idMap.end(); ++i ) { 59 os << i->first << " -> "; 60 i->second->printShort( os ); 61 os << std::endl; 62 } // for 65 63 } 66 64 65 // Local Variables: // 66 // tab-width: 4 // 67 // mode: c++ // 68 // compile-command: "make install" // 69 // End: //
Note: See TracChangeset
for help on using the changeset viewer.