| 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 | // Expression.cc --
|
|---|
| 8 | //
|
|---|
| 9 | // Author : Richard C. Bilson
|
|---|
| 10 | // Created On : Mon May 18 07:44:20 2015
|
|---|
| 11 | // Last Modified By : Andrew Beach
|
|---|
| 12 | // Last Modified On : Tue Aug 13 11:31:00 2019
|
|---|
| 13 | // Update Count : 63
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 | #include "SynTree/Expression.h"
|
|---|
| 17 |
|
|---|
| 18 | #include <cassert> // for assert, assertf
|
|---|
| 19 | #include <iostream> // for ostream, operator<<, basic_ostream
|
|---|
| 20 | #include <list> // for list, _List_iterator, list<>::co...
|
|---|
| 21 |
|
|---|
| 22 | #include "Common/utility.h" // for maybeClone, cloneAll, deleteAll
|
|---|
| 23 | #include "Declaration.h" // for ObjectDecl, DeclarationWithType
|
|---|
| 24 | #include "Expression.h" // for Expression, ImplicitCopyCtorExpr
|
|---|
| 25 | #include "InitTweak/InitTweak.h" // for getCallArg, getPointerBase
|
|---|
| 26 | #include "Initializer.h" // for Designation, Initializer
|
|---|
| 27 | #include "Statement.h" // for CompoundStmt, ExprStmt, Statement
|
|---|
| 28 | #include "SynTree/BaseSyntaxNode.h" // for BaseSyntaxNode
|
|---|
| 29 | #include "SynTree/Constant.h" // for Constant
|
|---|
| 30 | #include "Type.h" // for Type, BasicType, Type::Qualifiers
|
|---|
| 31 | #include "TypeSubstitution.h" // for TypeSubstitution
|
|---|
| 32 |
|
|---|
| 33 | #include "GenPoly/Lvalue.h"
|
|---|
| 34 |
|
|---|
| 35 | void printInferParams( const InferredParams & inferParams, std::ostream & os, Indenter indent, int level ) {
|
|---|
| 36 | if ( ! inferParams.empty() ) {
|
|---|
| 37 | os << indent << "with inferred parameters " << level << ":" << std::endl;
|
|---|
| 38 | for ( InferredParams::const_iterator i = inferParams.begin(); i != inferParams.end(); ++i ) {
|
|---|
| 39 | os << indent+1;
|
|---|
| 40 | assert(i->second.declptr);
|
|---|
| 41 | i->second.declptr->printShort( os, indent+1 );
|
|---|
| 42 | os << std::endl;
|
|---|
| 43 | printInferParams( i->second.expr->inferParams, os, indent+1, level+1 );
|
|---|
| 44 | } // for
|
|---|
| 45 | } // if
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | Expression::Expression() : result( 0 ), env( 0 ) {}
|
|---|
| 49 |
|
|---|
| 50 | Expression::Expression( const Expression & other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), extension( other.extension ), inferParams( other.inferParams ), resnSlots( other.resnSlots ) {}
|
|---|
| 51 |
|
|---|
| 52 | void Expression::spliceInferParams( Expression * other ) {
|
|---|
| 53 | if ( ! other ) return;
|
|---|
| 54 | for ( auto p : other->inferParams ) {
|
|---|
| 55 | inferParams[p.first] = std::move( p.second );
|
|---|
| 56 | }
|
|---|
| 57 | resnSlots.insert( resnSlots.end(), other->resnSlots.begin(), other->resnSlots.end() );
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | Expression::~Expression() {
|
|---|
| 61 | delete env;
|
|---|
| 62 | delete result;
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | bool Expression::get_lvalue() const {
|
|---|
| 66 | assert( !result->get_lvalue() );
|
|---|
| 67 | return false;
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | void Expression::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 71 | printInferParams( inferParams, os, indent+1, 0 );
|
|---|
| 72 |
|
|---|
| 73 | if ( env ) {
|
|---|
| 74 | os << std::endl << indent << "... with environment:" << std::endl;
|
|---|
| 75 | env->print( os, indent+1 );
|
|---|
| 76 | } // if
|
|---|
| 77 |
|
|---|
| 78 | if ( extension ) {
|
|---|
| 79 | os << std::endl << indent << "... with extension:";
|
|---|
| 80 | } // if
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | ConstantExpr::ConstantExpr( Constant _c ) : Expression(), constant( _c ) {
|
|---|
| 84 | set_result( constant.get_type()->clone() );
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | ConstantExpr::ConstantExpr( const ConstantExpr & other) : Expression( other ), constant( other.constant ) {
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | ConstantExpr::~ConstantExpr() {}
|
|---|
| 91 |
|
|---|
| 92 | void ConstantExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 93 | os << "constant expression " ;
|
|---|
| 94 | constant.print( os );
|
|---|
| 95 | Expression::print( os, indent );
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | long long int ConstantExpr::intValue() const {
|
|---|
| 99 | if ( BasicType * basicType = dynamic_cast< BasicType * >( result ) ) {
|
|---|
| 100 | if ( basicType->isInteger() ) {
|
|---|
| 101 | return get_constant()->get_ival();
|
|---|
| 102 | }
|
|---|
| 103 | } else if ( dynamic_cast< OneType * >( result ) ) {
|
|---|
| 104 | return 1;
|
|---|
| 105 | } else if ( dynamic_cast< ZeroType * >( result ) ) {
|
|---|
| 106 | return 0;
|
|---|
| 107 | }
|
|---|
| 108 | SemanticError( this, "Constant expression of non-integral type " );
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | VariableExpr::VariableExpr() : Expression(), var( nullptr ) {}
|
|---|
| 112 |
|
|---|
| 113 | VariableExpr::VariableExpr( DeclarationWithType *_var ) : Expression(), var( _var ) {
|
|---|
| 114 | assert( var );
|
|---|
| 115 | assert( var->get_type() );
|
|---|
| 116 | Type * type = var->get_type()->clone();
|
|---|
| 117 | type->set_lvalue( true );
|
|---|
| 118 |
|
|---|
| 119 | // xxx - doesn't quite work yet - get different alternatives with the same cost
|
|---|
| 120 |
|
|---|
| 121 | // // enumerators are not lvalues
|
|---|
| 122 | // if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( var->get_type() ) ) {
|
|---|
| 123 | // assert( inst->baseEnum );
|
|---|
| 124 | // EnumDecl * decl = inst->baseEnum;
|
|---|
| 125 | // long long int value;
|
|---|
| 126 | // if ( decl->valueOf( var, value ) ) {
|
|---|
| 127 | // type->set_lvalue( false );
|
|---|
| 128 | // }
|
|---|
| 129 | // }
|
|---|
| 130 |
|
|---|
| 131 | set_result( type );
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | VariableExpr::VariableExpr( const VariableExpr & other ) : Expression( other ), var( other.var ) {
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | VariableExpr::~VariableExpr() {
|
|---|
| 138 | // don't delete the declaration, since it points somewhere else in the tree
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| 141 | bool VariableExpr::get_lvalue() const {
|
|---|
| 142 | return result->get_lvalue();
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | VariableExpr * VariableExpr::functionPointer( FunctionDecl * func ) {
|
|---|
| 146 | VariableExpr * funcExpr = new VariableExpr( func );
|
|---|
| 147 | funcExpr->set_result( new PointerType( Type::Qualifiers(), funcExpr->get_result() ) );
|
|---|
| 148 | return funcExpr;
|
|---|
| 149 | }
|
|---|
| 150 |
|
|---|
| 151 | void VariableExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 152 | os << "Variable Expression: ";
|
|---|
| 153 | var->printShort(os, indent);
|
|---|
| 154 | Expression::print( os, indent );
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | SizeofExpr::SizeofExpr( Expression * expr_ ) :
|
|---|
| 158 | Expression(), expr(expr_), type(0), isType(false) {
|
|---|
| 159 | set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 | SizeofExpr::SizeofExpr( Type * type_ ) :
|
|---|
| 163 | Expression(), expr(0), type(type_), isType(true) {
|
|---|
| 164 | set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
|
|---|
| 165 | }
|
|---|
| 166 |
|
|---|
| 167 | SizeofExpr::SizeofExpr( const SizeofExpr & other ) :
|
|---|
| 168 | Expression( other ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) {
|
|---|
| 169 | }
|
|---|
| 170 |
|
|---|
| 171 | SizeofExpr::~SizeofExpr() {
|
|---|
| 172 | delete expr;
|
|---|
| 173 | delete type;
|
|---|
| 174 | }
|
|---|
| 175 |
|
|---|
| 176 | void SizeofExpr::print( std::ostream & os, Indenter indent) const {
|
|---|
| 177 | os << "Sizeof Expression on: ";
|
|---|
| 178 | if (isType) type->print(os, indent+1);
|
|---|
| 179 | else expr->print(os, indent+1);
|
|---|
| 180 | Expression::print( os, indent );
|
|---|
| 181 | }
|
|---|
| 182 |
|
|---|
| 183 | AlignofExpr::AlignofExpr( Expression * expr_ ) :
|
|---|
| 184 | Expression(), expr(expr_), type(0), isType(false) {
|
|---|
| 185 | set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 | AlignofExpr::AlignofExpr( Type * type_ ) :
|
|---|
| 189 | Expression(), expr(0), type(type_), isType(true) {
|
|---|
| 190 | set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
|
|---|
| 191 | }
|
|---|
| 192 |
|
|---|
| 193 | AlignofExpr::AlignofExpr( const AlignofExpr & other ) :
|
|---|
| 194 | Expression( other ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) {
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 | AlignofExpr::~AlignofExpr() {
|
|---|
| 198 | delete expr;
|
|---|
| 199 | delete type;
|
|---|
| 200 | }
|
|---|
| 201 |
|
|---|
| 202 | void AlignofExpr::print( std::ostream & os, Indenter indent) const {
|
|---|
| 203 | os << "Alignof Expression on: ";
|
|---|
| 204 | if (isType) type->print(os, indent+1);
|
|---|
| 205 | else expr->print(os, indent+1);
|
|---|
| 206 | Expression::print( os, indent );
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | UntypedOffsetofExpr::UntypedOffsetofExpr( Type * type, const std::string & member ) :
|
|---|
| 210 | Expression(), type(type), member(member) {
|
|---|
| 211 | assert( type );
|
|---|
| 212 | set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | UntypedOffsetofExpr::UntypedOffsetofExpr( const UntypedOffsetofExpr & other ) :
|
|---|
| 216 | Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {}
|
|---|
| 217 |
|
|---|
| 218 | UntypedOffsetofExpr::~UntypedOffsetofExpr() {
|
|---|
| 219 | delete type;
|
|---|
| 220 | }
|
|---|
| 221 |
|
|---|
| 222 | void UntypedOffsetofExpr::print( std::ostream & os, Indenter indent) const {
|
|---|
| 223 | os << "Untyped Offsetof Expression on member " << member << " of ";
|
|---|
| 224 | type->print(os, indent+1);
|
|---|
| 225 | Expression::print( os, indent );
|
|---|
| 226 | }
|
|---|
| 227 |
|
|---|
| 228 | OffsetofExpr::OffsetofExpr( Type * type, DeclarationWithType * member ) :
|
|---|
| 229 | Expression(), type(type), member(member) {
|
|---|
| 230 | assert( member );
|
|---|
| 231 | assert( type );
|
|---|
| 232 | set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
|
|---|
| 233 | }
|
|---|
| 234 |
|
|---|
| 235 | OffsetofExpr::OffsetofExpr( const OffsetofExpr & other ) :
|
|---|
| 236 | Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {}
|
|---|
| 237 |
|
|---|
| 238 | OffsetofExpr::~OffsetofExpr() {
|
|---|
| 239 | delete type;
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 | void OffsetofExpr::print( std::ostream & os, Indenter indent) const {
|
|---|
| 243 | os << "Offsetof Expression on member " << member->name << " of ";
|
|---|
| 244 | type->print(os, indent+1);
|
|---|
| 245 | Expression::print( os, indent );
|
|---|
| 246 | }
|
|---|
| 247 |
|
|---|
| 248 | OffsetPackExpr::OffsetPackExpr( StructInstType * type ) : Expression(), type( type ) {
|
|---|
| 249 | assert( type );
|
|---|
| 250 | set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
|
|---|
| 251 | }
|
|---|
| 252 |
|
|---|
| 253 | OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr & other ) : Expression( other ), type( maybeClone( other.type ) ) {}
|
|---|
| 254 |
|
|---|
| 255 | OffsetPackExpr::~OffsetPackExpr() { delete type; }
|
|---|
| 256 |
|
|---|
| 257 | void OffsetPackExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 258 | os << "Offset pack expression on ";
|
|---|
| 259 | type->print(os, indent+1);
|
|---|
| 260 | Expression::print( os, indent );
|
|---|
| 261 | }
|
|---|
| 262 |
|
|---|
| 263 | CastExpr::CastExpr( Expression * arg, Type * toType, bool isGenerated ) : arg(arg), isGenerated( isGenerated ) {
|
|---|
| 264 | set_result(toType);
|
|---|
| 265 | }
|
|---|
| 266 |
|
|---|
| 267 | CastExpr::CastExpr( Expression * arg, bool isGenerated ) : arg(arg), isGenerated( isGenerated ) {
|
|---|
| 268 | set_result( new VoidType( Type::Qualifiers() ) );
|
|---|
| 269 | }
|
|---|
| 270 |
|
|---|
| 271 | CastExpr::CastExpr( const CastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| 274 | CastExpr::~CastExpr() {
|
|---|
| 275 | delete arg;
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 | bool CastExpr::get_lvalue() const {
|
|---|
| 279 | return result->get_lvalue();
|
|---|
| 280 | }
|
|---|
| 281 |
|
|---|
| 282 | void CastExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 283 | os << (isGenerated ? "Generated " : "Explicit ") << "Cast of:" << std::endl << indent+1;
|
|---|
| 284 | arg->print(os, indent+1);
|
|---|
| 285 | os << std::endl << indent << "... to:";
|
|---|
| 286 | if ( result->isVoid() ) {
|
|---|
| 287 | os << " nothing";
|
|---|
| 288 | } else {
|
|---|
| 289 | os << std::endl << indent+1;
|
|---|
| 290 | result->print( os, indent+1 );
|
|---|
| 291 | } // if
|
|---|
| 292 | Expression::print( os, indent );
|
|---|
| 293 | }
|
|---|
| 294 |
|
|---|
| 295 | KeywordCastExpr::KeywordCastExpr( Expression * arg, Target target ) : Expression(), arg(arg), target( target ) {
|
|---|
| 296 | }
|
|---|
| 297 |
|
|---|
| 298 | KeywordCastExpr::KeywordCastExpr( const KeywordCastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ), target( other.target ) {
|
|---|
| 299 | }
|
|---|
| 300 |
|
|---|
| 301 | KeywordCastExpr::~KeywordCastExpr() {
|
|---|
| 302 | delete arg;
|
|---|
| 303 | }
|
|---|
| 304 |
|
|---|
| 305 | const std::string & KeywordCastExpr::targetString() const {
|
|---|
| 306 | static const std::string targetStrs[] = {
|
|---|
| 307 | "coroutine", "thread", "monitor"
|
|---|
| 308 | };
|
|---|
| 309 | static_assert(
|
|---|
| 310 | (sizeof(targetStrs) / sizeof(targetStrs[0])) == ((unsigned long)NUMBER_OF_TARGETS),
|
|---|
| 311 | "Each KeywordCastExpr::Target should have a corresponding string representation"
|
|---|
| 312 | );
|
|---|
| 313 | return targetStrs[(unsigned long)target];
|
|---|
| 314 | }
|
|---|
| 315 |
|
|---|
| 316 | void KeywordCastExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 317 | os << "Keyword Cast of:" << std::endl << indent+1;
|
|---|
| 318 | arg->print(os, indent+1);
|
|---|
| 319 | os << std::endl << indent << "... to: ";
|
|---|
| 320 | os << targetString();
|
|---|
| 321 | Expression::print( os, indent );
|
|---|
| 322 | }
|
|---|
| 323 |
|
|---|
| 324 | VirtualCastExpr::VirtualCastExpr( Expression * arg_, Type * toType ) : Expression(), arg(arg_) {
|
|---|
| 325 | set_result(toType);
|
|---|
| 326 | }
|
|---|
| 327 |
|
|---|
| 328 | VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
|
|---|
| 329 | }
|
|---|
| 330 |
|
|---|
| 331 | VirtualCastExpr::~VirtualCastExpr() {
|
|---|
| 332 | delete arg;
|
|---|
| 333 | }
|
|---|
| 334 |
|
|---|
| 335 | void VirtualCastExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 336 | os << "Virtual Cast of:" << std::endl << indent+1;
|
|---|
| 337 | arg->print(os, indent+1);
|
|---|
| 338 | os << std::endl << indent << "... to:";
|
|---|
| 339 | if ( ! result ) {
|
|---|
| 340 | os << " unknown";
|
|---|
| 341 | } else {
|
|---|
| 342 | os << std::endl << indent+1;
|
|---|
| 343 | result->print( os, indent+1 );
|
|---|
| 344 | } // if
|
|---|
| 345 | Expression::print( os, indent );
|
|---|
| 346 | }
|
|---|
| 347 |
|
|---|
| 348 | UntypedMemberExpr::UntypedMemberExpr( Expression * member, Expression * aggregate ) :
|
|---|
| 349 | Expression(), member(member), aggregate(aggregate) {
|
|---|
| 350 | assert( aggregate );
|
|---|
| 351 | }
|
|---|
| 352 |
|
|---|
| 353 | UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr & other ) :
|
|---|
| 354 | Expression( other ), member( maybeClone( other.member ) ), aggregate( maybeClone( other.aggregate ) ) {
|
|---|
| 355 | }
|
|---|
| 356 |
|
|---|
| 357 | UntypedMemberExpr::~UntypedMemberExpr() {
|
|---|
| 358 | delete aggregate;
|
|---|
| 359 | delete member;
|
|---|
| 360 | }
|
|---|
| 361 |
|
|---|
| 362 | void UntypedMemberExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 363 | os << "Untyped Member Expression, with field: " << std::endl << indent+1;
|
|---|
| 364 | member->print(os, indent+1 );
|
|---|
| 365 | os << indent << "... from aggregate:" << std::endl << indent+1;
|
|---|
| 366 | aggregate->print(os, indent+1);
|
|---|
| 367 | Expression::print( os, indent );
|
|---|
| 368 | }
|
|---|
| 369 |
|
|---|
| 370 | MemberExpr::MemberExpr( DeclarationWithType * member, Expression * aggregate ) :
|
|---|
| 371 | Expression(), member(member), aggregate(aggregate) {
|
|---|
| 372 | assert( member );
|
|---|
| 373 | assert( aggregate );
|
|---|
| 374 | assert( aggregate->result );
|
|---|
| 375 |
|
|---|
| 376 | TypeSubstitution sub = aggregate->result->genericSubstitution();
|
|---|
| 377 | Type * res = member->get_type()->clone();
|
|---|
| 378 | sub.apply( res );
|
|---|
| 379 | result = res;
|
|---|
| 380 | result->set_lvalue( true );
|
|---|
| 381 | result->get_qualifiers() |= aggregate->result->get_qualifiers();
|
|---|
| 382 | }
|
|---|
| 383 |
|
|---|
| 384 | MemberExpr::MemberExpr( const MemberExpr & other ) :
|
|---|
| 385 | Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) {
|
|---|
| 386 | }
|
|---|
| 387 |
|
|---|
| 388 | MemberExpr::~MemberExpr() {
|
|---|
| 389 | // don't delete the member declaration, since it points somewhere else in the tree
|
|---|
| 390 | delete aggregate;
|
|---|
| 391 | }
|
|---|
| 392 |
|
|---|
| 393 | bool MemberExpr::get_lvalue() const {
|
|---|
| 394 | assert( result->get_lvalue() );
|
|---|
| 395 | return true;
|
|---|
| 396 | }
|
|---|
| 397 |
|
|---|
| 398 | void MemberExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 399 | os << "Member Expression, with field:" << std::endl;
|
|---|
| 400 | os << indent+1;
|
|---|
| 401 | member->print( os, indent+1 );
|
|---|
| 402 | os << std::endl << indent << "... from aggregate:" << std::endl << indent+1;
|
|---|
| 403 | aggregate->print(os, indent + 1);
|
|---|
| 404 | Expression::print( os, indent );
|
|---|
| 405 | }
|
|---|
| 406 |
|
|---|
| 407 | UntypedExpr::UntypedExpr( Expression * function, const std::list<Expression *> & args ) :
|
|---|
| 408 | Expression(), function(function), args(args) {}
|
|---|
| 409 |
|
|---|
| 410 | UntypedExpr::UntypedExpr( const UntypedExpr & other ) :
|
|---|
| 411 | Expression( other ), function( maybeClone( other.function ) ) {
|
|---|
| 412 | cloneAll( other.args, args );
|
|---|
| 413 | }
|
|---|
| 414 |
|
|---|
| 415 | UntypedExpr::~UntypedExpr() {
|
|---|
| 416 | delete function;
|
|---|
| 417 | deleteAll( args );
|
|---|
| 418 | }
|
|---|
| 419 |
|
|---|
| 420 | UntypedExpr * UntypedExpr::createDeref( Expression * expr ) {
|
|---|
| 421 | UntypedExpr * ret = new UntypedExpr( new NameExpr("*?"), std::list< Expression * >{ expr } );
|
|---|
| 422 | if ( Type * type = expr->get_result() ) {
|
|---|
| 423 | Type * base = InitTweak::getPointerBase( type );
|
|---|
| 424 | assertf( base, "expected pointer type in dereference (type was %s)", toString( type ).c_str() );
|
|---|
| 425 | ret->set_result( base->clone() );
|
|---|
| 426 | if ( GenPoly::referencesPermissable() ) {
|
|---|
| 427 | // if references are still allowed in the AST, dereference returns a reference
|
|---|
| 428 | ret->set_result( new ReferenceType( Type::Qualifiers(), ret->get_result() ) );
|
|---|
| 429 | } else {
|
|---|
| 430 | // references have been removed, in which case dereference returns an lvalue of the base type.
|
|---|
| 431 | ret->result->set_lvalue( true );
|
|---|
| 432 | }
|
|---|
| 433 | }
|
|---|
| 434 | return ret;
|
|---|
| 435 | }
|
|---|
| 436 |
|
|---|
| 437 | UntypedExpr * UntypedExpr::createAssign( Expression * arg1, Expression * arg2 ) {
|
|---|
| 438 | assert( arg1 && arg2 );
|
|---|
| 439 | UntypedExpr * ret = new UntypedExpr( new NameExpr( "?=?" ), std::list< Expression * >{ arg1, arg2 } );
|
|---|
| 440 | if ( arg1->get_result() && arg2->get_result() ) {
|
|---|
| 441 | // if both expressions are typed, assumes that this assignment is a C bitwise assignment,
|
|---|
| 442 | // so the result is the type of the RHS
|
|---|
| 443 | ret->set_result( arg2->get_result()->clone() );
|
|---|
| 444 | }
|
|---|
| 445 | return ret;
|
|---|
| 446 | }
|
|---|
| 447 |
|
|---|
| 448 | bool UntypedExpr::get_lvalue() const {
|
|---|
| 449 | return result->get_lvalue();
|
|---|
| 450 | }
|
|---|
| 451 |
|
|---|
| 452 | void UntypedExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 453 | os << "Applying untyped:" << std::endl;
|
|---|
| 454 | os << indent+1;
|
|---|
| 455 | function->print(os, indent+1);
|
|---|
| 456 | os << std::endl << indent << "...to:" << std::endl;
|
|---|
| 457 | printAll(args, os, indent+1);
|
|---|
| 458 | Expression::print( os, indent );
|
|---|
| 459 | }
|
|---|
| 460 |
|
|---|
| 461 | NameExpr::NameExpr( std::string name ) : Expression(), name(name) {
|
|---|
| 462 | assertf(name != "0", "Zero is not a valid name");
|
|---|
| 463 | assertf(name != "1", "One is not a valid name");
|
|---|
| 464 | }
|
|---|
| 465 |
|
|---|
| 466 | NameExpr::NameExpr( const NameExpr & other ) : Expression( other ), name( other.name ) {
|
|---|
| 467 | }
|
|---|
| 468 |
|
|---|
| 469 | NameExpr::~NameExpr() {}
|
|---|
| 470 |
|
|---|
| 471 | void NameExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 472 | os << "Name: " << get_name();
|
|---|
| 473 | Expression::print( os, indent );
|
|---|
| 474 | }
|
|---|
| 475 |
|
|---|
| 476 | LogicalExpr::LogicalExpr( Expression * arg1_, Expression * arg2_, bool andp ) :
|
|---|
| 477 | Expression(), arg1(arg1_), arg2(arg2_), isAnd(andp) {
|
|---|
| 478 | set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
|
|---|
| 479 | }
|
|---|
| 480 |
|
|---|
| 481 | LogicalExpr::LogicalExpr( const LogicalExpr & other ) :
|
|---|
| 482 | Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), isAnd( other.isAnd ) {
|
|---|
| 483 | }
|
|---|
| 484 |
|
|---|
| 485 | LogicalExpr::~LogicalExpr() {
|
|---|
| 486 | delete arg1;
|
|---|
| 487 | delete arg2;
|
|---|
| 488 | }
|
|---|
| 489 |
|
|---|
| 490 | void LogicalExpr::print( std::ostream & os, Indenter indent )const {
|
|---|
| 491 | os << "Short-circuited operation (" << (isAnd ? "and" : "or") << ") on: ";
|
|---|
| 492 | arg1->print(os);
|
|---|
| 493 | os << " and ";
|
|---|
| 494 | arg2->print(os);
|
|---|
| 495 | Expression::print( os, indent );
|
|---|
| 496 | }
|
|---|
| 497 |
|
|---|
| 498 | ConditionalExpr::ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3 ) :
|
|---|
| 499 | Expression(), arg1(arg1), arg2(arg2), arg3(arg3) {}
|
|---|
| 500 |
|
|---|
| 501 | ConditionalExpr::ConditionalExpr( const ConditionalExpr & other ) :
|
|---|
| 502 | Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), arg3( maybeClone( other.arg3 ) ) {
|
|---|
| 503 | }
|
|---|
| 504 |
|
|---|
| 505 | ConditionalExpr::~ConditionalExpr() {
|
|---|
| 506 | delete arg1;
|
|---|
| 507 | delete arg2;
|
|---|
| 508 | delete arg3;
|
|---|
| 509 | }
|
|---|
| 510 |
|
|---|
| 511 | bool ConditionalExpr::get_lvalue() const {
|
|---|
| 512 | return result->get_lvalue();
|
|---|
| 513 | }
|
|---|
| 514 |
|
|---|
| 515 | void ConditionalExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 516 | os << "Conditional expression on: " << std::endl << indent+1;
|
|---|
| 517 | arg1->print( os, indent+1 );
|
|---|
| 518 | os << indent << "First alternative:" << std::endl << indent+1;
|
|---|
| 519 | arg2->print( os, indent+1 );
|
|---|
| 520 | os << indent << "Second alternative:" << std::endl << indent+1;
|
|---|
| 521 | arg3->print( os, indent+1 );
|
|---|
| 522 | Expression::print( os, indent );
|
|---|
| 523 | }
|
|---|
| 524 |
|
|---|
| 525 | AsmExpr::AsmExpr( const AsmExpr & other ) : Expression( other ), inout( maybeClone( other.inout ) ), constraint( maybeClone( other.constraint ) ), operand( maybeClone( other.operand ) ) {}
|
|---|
| 526 |
|
|---|
| 527 |
|
|---|
| 528 | void AsmExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 529 | os << "Asm Expression: " << std::endl;
|
|---|
| 530 | if ( inout ) inout->print( os, indent+1 );
|
|---|
| 531 | if ( constraint ) constraint->print( os, indent+1 );
|
|---|
| 532 | if ( operand ) operand->print( os, indent+1 );
|
|---|
| 533 | }
|
|---|
| 534 |
|
|---|
| 535 |
|
|---|
| 536 | ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) {
|
|---|
| 537 | assert( callExpr );
|
|---|
| 538 | assert( callExpr->result );
|
|---|
| 539 | set_result( callExpr->result->clone() );
|
|---|
| 540 | }
|
|---|
| 541 |
|
|---|
| 542 | ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) {
|
|---|
| 543 | }
|
|---|
| 544 |
|
|---|
| 545 | ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() {
|
|---|
| 546 | set_env( nullptr ); // ImplicitCopyCtorExpr does not take ownership of an environment
|
|---|
| 547 | delete callExpr;
|
|---|
| 548 | }
|
|---|
| 549 |
|
|---|
| 550 | void ImplicitCopyCtorExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 551 | os << "Implicit Copy Constructor Expression: " << std::endl << indent+1;
|
|---|
| 552 | callExpr->print( os, indent+1 );
|
|---|
| 553 | }
|
|---|
| 554 |
|
|---|
| 555 |
|
|---|
| 556 | ConstructorExpr::ConstructorExpr( Expression * callExpr ) : callExpr( callExpr ) {
|
|---|
| 557 | // allow resolver to type a constructor used as an expression as if it has the same type as its first argument
|
|---|
| 558 | assert( callExpr );
|
|---|
| 559 | Expression * arg = InitTweak::getCallArg( callExpr, 0 );
|
|---|
| 560 | assert( arg );
|
|---|
| 561 | set_result( maybeClone( arg->result ) );
|
|---|
| 562 | }
|
|---|
| 563 |
|
|---|
| 564 | ConstructorExpr::ConstructorExpr( const ConstructorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) {
|
|---|
| 565 | }
|
|---|
| 566 |
|
|---|
| 567 | ConstructorExpr::~ConstructorExpr() {
|
|---|
| 568 | delete callExpr;
|
|---|
| 569 | }
|
|---|
| 570 |
|
|---|
| 571 | bool ConstructorExpr::get_lvalue() const {
|
|---|
| 572 | return result->get_lvalue();
|
|---|
| 573 | }
|
|---|
| 574 |
|
|---|
| 575 | void ConstructorExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 576 | os << "Constructor Expression: " << std::endl << indent+1;
|
|---|
| 577 | callExpr->print( os, indent + 2 );
|
|---|
| 578 | Expression::print( os, indent );
|
|---|
| 579 | }
|
|---|
| 580 |
|
|---|
| 581 |
|
|---|
| 582 | CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : initializer( initializer ) {
|
|---|
| 583 | assert( type && initializer );
|
|---|
| 584 | type->set_lvalue( true );
|
|---|
| 585 | set_result( type );
|
|---|
| 586 | }
|
|---|
| 587 |
|
|---|
| 588 | CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr & other ) : Expression( other ), initializer( other.initializer->clone() ) {}
|
|---|
| 589 |
|
|---|
| 590 | CompoundLiteralExpr::~CompoundLiteralExpr() {
|
|---|
| 591 | delete initializer;
|
|---|
| 592 | }
|
|---|
| 593 |
|
|---|
| 594 | bool CompoundLiteralExpr::get_lvalue() const {
|
|---|
| 595 | assert( result->get_lvalue() );
|
|---|
| 596 | return true;
|
|---|
| 597 | }
|
|---|
| 598 |
|
|---|
| 599 | void CompoundLiteralExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 600 | os << "Compound Literal Expression: " << std::endl << indent+1;
|
|---|
| 601 | result->print( os, indent+1 );
|
|---|
| 602 | os << indent+1;
|
|---|
| 603 | initializer->print( os, indent+1 );
|
|---|
| 604 | Expression::print( os, indent );
|
|---|
| 605 | }
|
|---|
| 606 |
|
|---|
| 607 | RangeExpr::RangeExpr( Expression * low, Expression * high ) : low( low ), high( high ) {}
|
|---|
| 608 | RangeExpr::RangeExpr( const RangeExpr & other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {}
|
|---|
| 609 | void RangeExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 610 | os << "Range Expression: ";
|
|---|
| 611 | low->print( os, indent );
|
|---|
| 612 | os << " ... ";
|
|---|
| 613 | high->print( os, indent );
|
|---|
| 614 | Expression::print( os, indent );
|
|---|
| 615 | }
|
|---|
| 616 |
|
|---|
| 617 | StmtExpr::StmtExpr( CompoundStmt * statements ) : statements( statements ) {
|
|---|
| 618 | computeResult();
|
|---|
| 619 | }
|
|---|
| 620 | StmtExpr::StmtExpr( const StmtExpr & other ) : Expression( other ), statements( other.statements->clone() ), resultExpr( other.resultExpr ) {
|
|---|
| 621 | cloneAll( other.returnDecls, returnDecls );
|
|---|
| 622 | cloneAll( other.dtors, dtors );
|
|---|
| 623 | }
|
|---|
| 624 | StmtExpr::~StmtExpr() {
|
|---|
| 625 | delete statements;
|
|---|
| 626 | deleteAll( dtors );
|
|---|
| 627 | deleteAll( returnDecls );
|
|---|
| 628 | }
|
|---|
| 629 | void StmtExpr::computeResult() {
|
|---|
| 630 | assert( statements );
|
|---|
| 631 | std::list< Statement * > & body = statements->kids;
|
|---|
| 632 | delete result;
|
|---|
| 633 | result = nullptr;
|
|---|
| 634 | if ( ! returnDecls.empty() ) {
|
|---|
| 635 | // prioritize return decl for result type, since if a return decl exists, then
|
|---|
| 636 | // the StmtExpr is currently in an intermediate state where the body will always
|
|---|
| 637 | // give a void result type.
|
|---|
| 638 | result = returnDecls.front()->get_type()->clone();
|
|---|
| 639 | } else if ( ! body.empty() ) {
|
|---|
| 640 | if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {
|
|---|
| 641 | result = maybeClone( exprStmt->expr->result );
|
|---|
| 642 | }
|
|---|
| 643 | }
|
|---|
| 644 | // ensure that StmtExpr has a result type
|
|---|
| 645 | if ( ! result ) {
|
|---|
| 646 | result = new VoidType( Type::Qualifiers() );
|
|---|
| 647 | }
|
|---|
| 648 | }
|
|---|
| 649 | void StmtExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 650 | os << "Statement Expression: " << std::endl << indent+1;
|
|---|
| 651 | statements->print( os, indent+1 );
|
|---|
| 652 | if ( ! returnDecls.empty() ) {
|
|---|
| 653 | os << indent+1 << "... with returnDecls: ";
|
|---|
| 654 | printAll( returnDecls, os, indent+1 );
|
|---|
| 655 | }
|
|---|
| 656 | if ( ! dtors.empty() ) {
|
|---|
| 657 | os << indent+1 << "... with dtors: ";
|
|---|
| 658 | printAll( dtors, os, indent+1 );
|
|---|
| 659 | }
|
|---|
| 660 | Expression::print( os, indent );
|
|---|
| 661 | }
|
|---|
| 662 |
|
|---|
| 663 |
|
|---|
| 664 | long long UniqueExpr::count = 0;
|
|---|
| 665 | UniqueExpr::UniqueExpr( Expression * expr, long long idVal ) : expr( expr ), object( nullptr ), var( nullptr ), id( idVal ) {
|
|---|
| 666 | assert( expr );
|
|---|
| 667 | assert( count != -1 );
|
|---|
| 668 | if ( id == -1 ) id = count++;
|
|---|
| 669 | if ( expr->get_result() ) {
|
|---|
| 670 | set_result( expr->get_result()->clone() );
|
|---|
| 671 | }
|
|---|
| 672 | }
|
|---|
| 673 | UniqueExpr::UniqueExpr( const UniqueExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), object( maybeClone( other.object ) ), var( maybeClone( other.var ) ), id( other.id ) {
|
|---|
| 674 | }
|
|---|
| 675 | UniqueExpr::~UniqueExpr() {
|
|---|
| 676 | delete expr;
|
|---|
| 677 | delete object;
|
|---|
| 678 | delete var;
|
|---|
| 679 | }
|
|---|
| 680 | void UniqueExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 681 | os << "Unique Expression with id:" << id << std::endl << indent+1;
|
|---|
| 682 | expr->print( os, indent+1 );
|
|---|
| 683 | if ( object ) {
|
|---|
| 684 | os << indent << "... with decl: ";
|
|---|
| 685 | get_object()->printShort( os, indent+1 );
|
|---|
| 686 | }
|
|---|
| 687 | Expression::print( os, indent );
|
|---|
| 688 | }
|
|---|
| 689 |
|
|---|
| 690 | InitAlternative::InitAlternative( Type * type, Designation * designation ) : type( type ), designation( designation ) {}
|
|---|
| 691 | InitAlternative::InitAlternative( const InitAlternative & other ) : type( maybeClone( other.type ) ), designation( maybeClone( other.designation ) ) {}
|
|---|
| 692 | InitAlternative::~InitAlternative() {
|
|---|
| 693 | delete type;
|
|---|
| 694 | delete designation;
|
|---|
| 695 | }
|
|---|
| 696 |
|
|---|
| 697 | UntypedInitExpr::UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ) : expr( expr ), initAlts( initAlts ) {}
|
|---|
| 698 | UntypedInitExpr::UntypedInitExpr( const UntypedInitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), initAlts( other.initAlts ) {}
|
|---|
| 699 | UntypedInitExpr::~UntypedInitExpr() {
|
|---|
| 700 | delete expr;
|
|---|
| 701 | }
|
|---|
| 702 |
|
|---|
| 703 | void UntypedInitExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 704 | os << "Untyped Init Expression" << std::endl << indent+1;
|
|---|
| 705 | expr->print( os, indent+1 );
|
|---|
| 706 | if ( ! initAlts.empty() ) {
|
|---|
| 707 | for ( const InitAlternative & alt : initAlts ) {
|
|---|
| 708 | os << indent+1 << "InitAlternative: ";
|
|---|
| 709 | alt.type->print( os, indent+1 );
|
|---|
| 710 | alt.designation->print( os, indent+1 );
|
|---|
| 711 | }
|
|---|
| 712 | }
|
|---|
| 713 | }
|
|---|
| 714 |
|
|---|
| 715 | InitExpr::InitExpr( Expression * expr, Designation * designation ) : expr( expr ), designation( designation ) {
|
|---|
| 716 | set_result( expr->get_result()->clone() );
|
|---|
| 717 | }
|
|---|
| 718 | InitExpr::InitExpr( const InitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), designation( maybeClone( other.designation) ) {}
|
|---|
| 719 | InitExpr::~InitExpr() {
|
|---|
| 720 | delete expr;
|
|---|
| 721 | delete designation;
|
|---|
| 722 | }
|
|---|
| 723 |
|
|---|
| 724 | void InitExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 725 | os << "Init Expression" << std::endl << indent+1;
|
|---|
| 726 | expr->print( os, indent+1 );
|
|---|
| 727 | os << indent+1 << "... with designation: ";
|
|---|
| 728 | designation->print( os, indent+1 );
|
|---|
| 729 | }
|
|---|
| 730 |
|
|---|
| 731 | DeletedExpr::DeletedExpr( Expression * expr, Declaration * deleteStmt ) : expr( expr ), deleteStmt( deleteStmt ) {
|
|---|
| 732 | assert( expr->result );
|
|---|
| 733 | result = expr->result->clone();
|
|---|
| 734 | }
|
|---|
| 735 | DeletedExpr::DeletedExpr( const DeletedExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), deleteStmt( other.deleteStmt ) {}
|
|---|
| 736 | DeletedExpr::~DeletedExpr() {
|
|---|
| 737 | delete expr;
|
|---|
| 738 | }
|
|---|
| 739 |
|
|---|
| 740 | void DeletedExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 741 | os << "Deleted Expression" << std::endl << indent+1;
|
|---|
| 742 | expr->print( os, indent+1 );
|
|---|
| 743 | os << std::endl << indent+1 << "... deleted by: ";
|
|---|
| 744 | deleteStmt->print( os, indent+1 );
|
|---|
| 745 | }
|
|---|
| 746 |
|
|---|
| 747 |
|
|---|
| 748 | DefaultArgExpr::DefaultArgExpr( Expression * expr ) : expr( expr ) {
|
|---|
| 749 | assert( expr->result );
|
|---|
| 750 | result = expr->result->clone();
|
|---|
| 751 | }
|
|---|
| 752 | DefaultArgExpr::DefaultArgExpr( const DefaultArgExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ) {}
|
|---|
| 753 | DefaultArgExpr::~DefaultArgExpr() {
|
|---|
| 754 | delete expr;
|
|---|
| 755 | }
|
|---|
| 756 |
|
|---|
| 757 | void DefaultArgExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 758 | os << "Default Argument Expression" << std::endl << indent+1;
|
|---|
| 759 | expr->print( os, indent+1 );
|
|---|
| 760 | }
|
|---|
| 761 |
|
|---|
| 762 | GenericExpr::Association::Association( Type * type, Expression * expr ) : type( type ), expr( expr ), isDefault( false ) {}
|
|---|
| 763 | GenericExpr::Association::Association( Expression * expr ) : type( nullptr ), expr( expr ), isDefault( true ) {}
|
|---|
| 764 | GenericExpr::Association::Association( const Association & other ) : type( maybeClone( other.type ) ), expr( maybeClone( other.expr ) ), isDefault( other.isDefault ) {}
|
|---|
| 765 | GenericExpr::Association::~Association() {
|
|---|
| 766 | delete type;
|
|---|
| 767 | delete expr;
|
|---|
| 768 | }
|
|---|
| 769 |
|
|---|
| 770 | GenericExpr::GenericExpr( Expression * control, const std::list<Association> & assoc ) : Expression(), control( control ), associations( assoc ) {}
|
|---|
| 771 | GenericExpr::GenericExpr( const GenericExpr & other ) : Expression(other), control( maybeClone( other.control ) ), associations( other.associations ) {
|
|---|
| 772 | }
|
|---|
| 773 | GenericExpr::~GenericExpr() {
|
|---|
| 774 | delete control;
|
|---|
| 775 | }
|
|---|
| 776 |
|
|---|
| 777 | void GenericExpr::print( std::ostream & os, Indenter indent ) const {
|
|---|
| 778 | os << "C11 _Generic Expression" << std::endl << indent+1;
|
|---|
| 779 | control->print( os, indent+1 );
|
|---|
| 780 | os << std::endl << indent+1 << "... with associations: " << std::endl;
|
|---|
| 781 | for ( const Association & assoc : associations ) {
|
|---|
| 782 | os << indent+1;
|
|---|
| 783 | if (assoc.isDefault) {
|
|---|
| 784 | os << "... default: ";
|
|---|
| 785 | assoc.expr->print( os, indent+1 );
|
|---|
| 786 | } else {
|
|---|
| 787 | os << "... type: ";
|
|---|
| 788 | assoc.type->print( os, indent+1 );
|
|---|
| 789 | os << std::endl << indent+1 << "... expression: ";
|
|---|
| 790 | assoc.expr->print( os, indent+1 );
|
|---|
| 791 | os << std::endl;
|
|---|
| 792 | }
|
|---|
| 793 | os << std::endl;
|
|---|
| 794 | }
|
|---|
| 795 | }
|
|---|
| 796 |
|
|---|
| 797 | // Local Variables: //
|
|---|
| 798 | // tab-width: 4 //
|
|---|
| 799 | // mode: c++ //
|
|---|
| 800 | // compile-command: "make install" //
|
|---|
| 801 | // End: //
|
|---|