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/PointerType.cc

    ra32b204 r0dd3a2f  
    1 /*
    2  * This file is part of the Cforall project
    3  *
    4  * $Id: PointerType.cc,v 1.8 2005/08/29 20:59:26 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// PointerType.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 10:15:16 2015
     13// Update Count     : 2
     14//
    715
    816#include "Type.h"
     
    1018#include "utility.h"
    1119
    12 
    1320PointerType::PointerType( const Type::Qualifiers &tq, Type *base )
    14     : Type( tq ), base( base ), dimension( 0 ), isVarLen( false ), isStatic( false )
    15 {
    16     base->set_isLvalue( false );
     21        : Type( tq ), base( base ), dimension( 0 ), isVarLen( false ), isStatic( false ) {
     22        base->set_isLvalue( false );
    1723}
    1824
    1925PointerType::PointerType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic )
    20     : Type( tq ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic )
    21 {
    22     base->set_isLvalue( false );
     26        : Type( tq ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) {
     27        base->set_isLvalue( false );
    2328}
    2429
    2530PointerType::PointerType( const PointerType &other )
    26     : Type( other ), base( maybeClone( other.base ) ), dimension( maybeClone( other.dimension ) ),
    27         isVarLen( other.isVarLen ), isStatic( other.isStatic )
    28 {
     31        : Type( other ), base( maybeClone( other.base ) ), dimension( maybeClone( other.dimension ) ),
     32          isVarLen( other.isVarLen ), isStatic( other.isStatic ) {
    2933}
    3034
    31 PointerType::~PointerType()
    32 {
    33     delete base;
    34     delete dimension;
     35PointerType::~PointerType() {
     36        delete base;
     37        delete dimension;
    3538}
    3639
    37 void
    38 PointerType::print( std::ostream &os, int indent ) const
    39 {
    40     Type::print( os, indent );
    41     os << "pointer to ";
    42     if ( isStatic ) {
    43         os << "static ";
    44     }
    45     if ( isVarLen ) {
    46         os << "variable length array of ";
    47     } else if ( dimension ) {
    48         os << "array of ";
    49         dimension->print( os, indent );
    50     }
    51     if ( base ) {
    52         base->print( os, indent );
    53     }
     40void PointerType::print( std::ostream &os, int indent ) const {
     41        Type::print( os, indent );
     42        os << "pointer to ";
     43        if ( isStatic ) {
     44                os << "static ";
     45        } // if
     46        if ( isVarLen ) {
     47                os << "variable length array of ";
     48        } else if ( dimension ) {
     49                os << "array of ";
     50                dimension->print( os, indent );
     51        } // if
     52        if ( base ) {
     53                base->print( os, indent );
     54        } // if
    5455}
    5556
     57// Local Variables: //
     58// tab-width: 4 //
     59// mode: c++ //
     60// compile-command: "make install" //
     61// End: //
Note: See TracChangeset for help on using the changeset viewer.