source: translator/SynTree/AttrType.cc @ 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: 1.0 KB
Line 
1/*
2 * This file is part of the Cforall project
3 *
4 * $Id: AttrType.cc,v 1.3 2005/08/29 20:59:25 rcbilson Exp $
5 *
6 */
7
8#include "Type.h"
9#include "Expression.h"
10#include "utility.h"
11
12
13AttrType::AttrType( const Type::Qualifiers &tq, const std::string &name, Expression *expr )
14    : Type( tq ), name( name ), expr( expr ), type( 0 ), isType( false )
15{
16}
17
18AttrType::AttrType( const Type::Qualifiers &tq, const std::string &name, Type *type )
19    : Type( tq ), name( name ), expr( 0 ), type( type ), isType( true )
20{
21}
22
23AttrType::AttrType( const AttrType &other )
24    : Type( other ), name( other.name ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType )
25{
26}
27
28AttrType::~AttrType()
29{
30    delete expr;
31    delete type;
32}
33
34void 
35AttrType::print( std::ostream &os, int indent ) const
36{
37    Type::print( os, indent );
38    os << "attribute " << name << " applied to ";
39    if( expr ) {
40        os << "expression ";
41        expr->print( os, indent );
42    }
43    if( type ) {
44        os << "type ";
45        type->print( os, indent );
46    }
47}
48
Note: See TracBrowser for help on using the repository browser.