Ignore:
Timestamp:
May 18, 2015, 11:20:23 AM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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
Message:

licencing: third groups of files

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//
    715
    816#include <string>
     
    1422#include "utility.h"
    1523
    16 
    1724const char* Declaration::storageClassName[] = { "", "auto", "static", "extern", "register" }; 
    1825
     
    2229
    2330Declaration::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 ) {
    2632}
    2733
    2834Declaration::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 ) {
    3136}
    3237
    33 Declaration::~Declaration()
    34 {
     38Declaration::~Declaration() {
    3539}
    3640
    37 void
    38 Declaration::fixUniqueId()
    39 {
    40     uniqueId = ++lastUniqueId;
    41     idMap[ uniqueId ] = this;
     41void Declaration::fixUniqueId() {
     42        uniqueId = ++lastUniqueId;
     43        idMap[ uniqueId ] = this;
    4244}
    4345
    4446/* 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     }
     47Declaration *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
    5454}
    5555
    5656/* 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     }
     57void 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
    6563}
    6664
     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.