source: src/Parser/ExpressionNode.cc@ 76c62b2

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 76c62b2 was 76c62b2, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

first attempt at user-defined constants (units)

  • Property mode set to 100644
File size: 18.4 KB
RevLine 
[b87a5ed]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//
[0caaa6a]7// ExpressionNode.cc --
8//
[b87a5ed]9// Author : Rodolfo G. Esteves
10// Created On : Sat May 16 13:17:07 2015
[76c62b2]11// Last Modified By : Peter A. Buhr
12// Last Modified On : Thu Aug 31 21:05:04 2017
13// Update Count : 605
[0caaa6a]14//
[b87a5ed]15
[ea6332d]16#include <cassert> // for assert
[d180746]17#include <stdio.h> // for sscanf, size_t
18#include <climits> // for LLONG_MAX, LONG_MAX, INT_MAX, UINT...
19#include <list> // for list
20#include <sstream> // for basic_istream::operator>>, basic_i...
21#include <string> // for string, operator+, operator==
[51b73452]22
[d180746]23#include "Common/SemanticError.h" // for SemanticError
24#include "Common/utility.h" // for maybeMoveBuild, maybeBuild, CodeLo...
25#include "ParseNode.h" // for ExpressionNode, maybeMoveBuildType
26#include "SynTree/Constant.h" // for Constant
27#include "SynTree/Declaration.h" // for EnumDecl, StructDecl, UnionDecl
28#include "SynTree/Expression.h" // for Expression, ConstantExpr, NameExpr
29#include "SynTree/Statement.h" // for CompoundStmt, Statement
30#include "SynTree/Type.h" // for BasicType, Type, Type::Qualifiers
31#include "parserutility.h" // for notZeroExpr
32
33class Initializer;
[51b73452]34
35using namespace std;
36
[cd623a4]37//##############################################################################
38
[7bf7fb9]39// Difficult to separate extra parts of constants during lexing because actions are not allow in the middle of patterns:
40//
41// prefix action constant action suffix
42//
43// Alternatively, breaking a pattern using BEGIN does not work if the following pattern can be empty:
44//
45// constant BEGIN CONT ...
46// <CONT>(...)? BEGIN 0 ... // possible empty suffix
47//
48// because the CONT rule is NOT triggered if the pattern is empty. Hence, constants are reparsed here to determine their
49// type.
50
[65cdc1e]51extern const Type::Qualifiers noQualifiers; // no qualifiers on constants
[7bf7fb9]52
53static inline bool checkU( char c ) { return c == 'u' || c == 'U'; }
54static inline bool checkL( char c ) { return c == 'l' || c == 'L'; }
55static inline bool checkF( char c ) { return c == 'f' || c == 'F'; }
56static inline bool checkD( char c ) { return c == 'd' || c == 'D'; }
57static inline bool checkI( char c ) { return c == 'i' || c == 'I'; }
58static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }
59
[76c62b2]60static void sepNumeric( string & str, string & units ) {
61 string::size_type posn = str.find_first_of( "`" );
62 if ( posn != string::npos ) {
63 units = str.substr( posn ); // extract units
64 str.erase( posn ); // remove units
65 } // if
66} // sepNumeric
67
68Expression * build_constantInteger( std::string & str ) {
[7bf7fb9]69 static const BasicType::Kind kind[2][3] = {
70 { BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt },
71 { BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt },
72 };
[76c62b2]73
74 string units; // units
75 sepNumeric( str, units ); // separate constant from units
76
[7bf7fb9]77 bool dec = true, Unsigned = false; // decimal, unsigned constant
78 int size; // 0 => int, 1 => long, 2 => long long
[6165ce7]79 unsigned long long int v; // converted integral value
[7bf7fb9]80 size_t last = str.length() - 1; // last character of constant
[6165ce7]81 Expression * ret;
[7bf7fb9]82
[76c62b2]83 // ROB: what do we do with units on 0 and 1?
[6165ce7]84 // special constants
85 if ( str == "0" ) {
86 ret = new ConstantExpr( Constant( (Type *)new ZeroType( noQualifiers ), str, (unsigned long long int)0 ) );
87 goto CLEANUP;
88 } // if
89 if ( str == "1" ) {
90 ret = new ConstantExpr( Constant( (Type *)new OneType( noQualifiers ), str, (unsigned long long int)1 ) );
91 goto CLEANUP;
92 } // if
[ea6332d]93
[7bf7fb9]94 if ( str[0] == '0' ) { // octal/hex constant ?
95 dec = false;
96 if ( last != 0 && checkX( str[1] ) ) { // hex constant ?
97 sscanf( (char *)str.c_str(), "%llx", &v );
98 //printf( "%llx %llu\n", v, v );
99 } else { // octal constant
100 sscanf( (char *)str.c_str(), "%llo", &v );
101 //printf( "%llo %llu\n", v, v );
102 } // if
103 } else { // decimal constant ?
104 sscanf( (char *)str.c_str(), "%llu", &v );
105 //printf( "%llu %llu\n", v, v );
106 } // if
107
108 if ( v <= INT_MAX ) { // signed int
109 size = 0;
110 } else if ( v <= UINT_MAX && ! dec ) { // unsigned int
111 size = 0;
112 Unsigned = true; // unsigned
113 } else if ( v <= LONG_MAX ) { // signed long int
114 size = 1;
115 } else if ( v <= ULONG_MAX && ( ! dec || LONG_MAX == LLONG_MAX ) ) { // signed long int
116 size = 1;
117 Unsigned = true; // unsigned long int
118 } else if ( v <= LLONG_MAX ) { // signed long long int
119 size = 2;
120 } else { // unsigned long long int
121 size = 2;
122 Unsigned = true; // unsigned long long int
123 } // if
124
125 if ( checkU( str[last] ) ) { // suffix 'u' ?
126 Unsigned = true;
127 if ( last > 0 && checkL( str[last - 1] ) ) { // suffix 'l' ?
128 size = 1;
129 if ( last > 1 && checkL( str[last - 2] ) ) { // suffix 'll' ?
130 size = 2;
131 } // if
132 } // if
133 } else if ( checkL( str[ last ] ) ) { // suffix 'l' ?
134 size = 1;
135 if ( last > 0 && checkL( str[last - 1] ) ) { // suffix 'll' ?
136 size = 2;
137 if ( last > 1 && checkU( str[last - 2] ) ) { // suffix 'u' ?
138 Unsigned = true;
139 } // if
140 } else {
141 if ( last > 0 && checkU( str[last - 1] ) ) { // suffix 'u' ?
142 Unsigned = true;
143 } // if
144 } // if
145 } // if
146
[76c62b2]147// if ( units.length() == 0 ) {
148 ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );
149// } else {
150// // ROB: generate call to units routine
151// ret = nullptr;
152// } // if
[6165ce7]153 CLEANUP:
[ab57786]154 delete &str; // created by lex
155 return ret;
[7bf7fb9]156} // build_constantInteger
[51b73452]157
[76c62b2]158Expression * build_constantFloat( std::string & str ) {
[7bf7fb9]159 static const BasicType::Kind kind[2][3] = {
160 { BasicType::Float, BasicType::Double, BasicType::LongDouble },
161 { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex },
162 };
[59c24b6]163
[76c62b2]164 string units; // units
165 sepNumeric( str, units ); // separate constant from units
166
[7bf7fb9]167 bool complx = false; // real, complex
168 int size = 1; // 0 => float, 1 => double (default), 2 => long double
169 // floating-point constant has minimum of 2 characters: 1. or .1
170 size_t last = str.length() - 1;
[d56e5bc]171 double v;
172
173 sscanf( str.c_str(), "%lg", &v );
[51b73452]174
[7bf7fb9]175 if ( checkI( str[last] ) ) { // imaginary ?
176 complx = true;
177 last -= 1; // backup one character
178 } // if
[0caaa6a]179
[7bf7fb9]180 if ( checkF( str[last] ) ) { // float ?
181 size = 0;
182 } else if ( checkD( str[last] ) ) { // double ?
183 size = 1;
184 } else if ( checkL( str[last] ) ) { // long double ?
185 size = 2;
186 } // if
187 if ( ! complx && checkI( str[last - 1] ) ) { // imaginary ?
188 complx = true;
189 } // if
[51b73452]190
[76c62b2]191 Expression * ret;
192// if ( units.length() == 0 ) {
193 ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );
194// } else {
195// ret = nullptr;
196// // ROB: generate call to units routine
197// } // if
198
[ab57786]199 delete &str; // created by lex
200 return ret;
[7bf7fb9]201} // build_constantFloat
[51b73452]202
[76c62b2]203static void sepString( string & str, string & units, char delimit ) {
204 string::size_type posn = str.find_last_of( delimit ) + 1;
205 if ( posn != str.length() ) {
206 units = str.substr( posn ); // extract units
207 str.erase( posn ); // remove units
208 } // if
209} // sepString
210
211Expression * build_constantChar( std::string & str ) {
212 string units; // units
213 sepString( str, units, '\'' ); // separate constant from units
214
215 Expression * ret;
216// if ( units.length() == 0 ) {
217 ret = new ConstantExpr( Constant( new BasicType( noQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) );
218// } else {
219// ret = nullptr;
220// // ROB: generate call to units routine
221// } // if
222
[ab57786]223 delete &str; // created by lex
224 return ret;
[7bf7fb9]225} // build_constantChar
[51b73452]226
[76c62b2]227ConstantExpr * build_constantStr( std::string & str ) {
228 string units; // units
229 sepString( str, units, '"' ); // separate constant from units
230
231 ConstantExpr * ret;
232// if ( units.length() == 0 ) {
233 // string should probably be a primitive type
234 ArrayType * at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ),
235 new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"'
236 false, false );
237 ret = new ConstantExpr( Constant( at, str, (unsigned long long int)0 ) ); // constant 0 is ignored for pure string value
238// } else {
239// ret = nullptr;
240// // ROB: generate call to units routine
241// } // if
242
[ab57786]243 delete &str; // created by lex
244 return ret;
[7bf7fb9]245} // build_constantStr
[51b73452]246
[8780e30]247Expression * build_field_name_FLOATINGconstant( const std::string & str ) {
248 // str is of the form A.B -> separate at the . and return member expression
249 int a, b;
250 char dot;
251 std::stringstream ss( str );
252 ss >> a >> dot >> b;
[d56e5bc]253 UntypedMemberExpr * ret = new UntypedMemberExpr( new ConstantExpr( Constant::from_int( b ) ), new ConstantExpr( Constant::from_int( a ) ) );
[8780e30]254 delete &str;
255 return ret;
256} // build_field_name_FLOATINGconstant
257
258Expression * make_field_name_fraction_constants( Expression * fieldName, Expression * fracts ) {
259 if ( fracts ) {
260 if ( UntypedMemberExpr * memberExpr = dynamic_cast< UntypedMemberExpr * >( fracts ) ) {
261 memberExpr->set_member( make_field_name_fraction_constants( fieldName, memberExpr->get_aggregate() ) );
262 return memberExpr;
263 } else {
264 return new UntypedMemberExpr( fracts, fieldName );
265 }
266 }
267 return fieldName;
268} // make_field_name_fraction_constants
269
270Expression * build_field_name_fraction_constants( Expression * fieldName, ExpressionNode * fracts ) {
271 return make_field_name_fraction_constants( fieldName, maybeMoveBuild< Expression >( fracts ) );
272} // build_field_name_fraction_constants
273
274Expression * build_field_name_REALFRACTIONconstant( const std::string & str ) {
[0213af6]275 if ( str.find_first_not_of( "0123456789", 1 ) != string::npos ) throw SemanticError( "invalid tuple index " + str );
[8780e30]276 Expression * ret = build_constantInteger( *new std::string( str.substr(1) ) );
277 delete &str;
278 return ret;
279} // build_field_name_REALFRACTIONconstant
280
281Expression * build_field_name_REALDECIMALconstant( const std::string & str ) {
[0213af6]282 if ( str[str.size()-1] != '.' ) throw SemanticError( "invalid tuple index " + str );
[8780e30]283 Expression * ret = build_constantInteger( *new std::string( str.substr( 0, str.size()-1 ) ) );
284 delete &str;
285 return ret;
286} // build_field_name_REALDECIMALconstant
287
[a2e0687]288NameExpr * build_varref( const string * name ) {
289 NameExpr * expr = new NameExpr( *name, nullptr );
[7ecbb7e]290 delete name;
291 return expr;
[a2e0687]292} // build_varref
[51b1202]293
[a2e0687]294
295static const char * OperName[] = { // must harmonize with OperKinds
[5721a6d]296 // diadic
[e5f2a67]297 "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?\\?", "?*?", "?/?", "?%?", "||", "&&",
[5721a6d]298 "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?",
[e5f2a67]299 "?=?", "?@=?", "?\\=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
[d9e2280]300 "?[?]", "...",
[5721a6d]301 // monadic
302 "+?", "-?", "AddressOf", "*?", "!?", "~?", "++?", "?++", "--?", "?--", "&&"
[a2e0687]303}; // OperName
[5721a6d]304
[a2e0687]305Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ) {
306 Type * targetType = maybeMoveBuildType( decl_node );
[d1625f8]307 if ( dynamic_cast< VoidType * >( targetType ) ) {
[064e3ff]308 delete targetType;
[7ecbb7e]309 return new CastExpr( maybeMoveBuild< Expression >(expr_node) );
[064e3ff]310 } else {
[7ecbb7e]311 return new CastExpr( maybeMoveBuild< Expression >(expr_node), targetType );
[064e3ff]312 } // if
[a2e0687]313} // build_cast
[a5f0529]314
[a2e0687]315Expression * build_virtual_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ) {
316 Type * targetType = maybeMoveBuildType( decl_node );
317 Expression * castArg = maybeMoveBuild< Expression >( expr_node );
[a5f0529]318 return new VirtualCastExpr( castArg, targetType );
[a2e0687]319} // build_virtual_cast
[064e3ff]320
[a2e0687]321Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member ) {
322 UntypedMemberExpr * ret = new UntypedMemberExpr( member, maybeMoveBuild< Expression >(expr_node) );
[064e3ff]323 return ret;
[a2e0687]324} // build_fieldSel
[064e3ff]325
[a2e0687]326Expression * build_pfieldSel( ExpressionNode * expr_node, Expression * member ) {
327 UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) );
[64ac636]328 deref->location = expr_node->location;
[7ecbb7e]329 deref->get_args().push_back( maybeMoveBuild< Expression >(expr_node) );
[a2e0687]330 UntypedMemberExpr * ret = new UntypedMemberExpr( member, deref );
[064e3ff]331 return ret;
[a2e0687]332} // build_pfieldSel
[064e3ff]333
[a2e0687]334Expression * build_addressOf( ExpressionNode * expr_node ) {
[7ecbb7e]335 return new AddressExpr( maybeMoveBuild< Expression >(expr_node) );
[a2e0687]336} // build_addressOf
337
338Expression * build_sizeOfexpr( ExpressionNode * expr_node ) {
[7ecbb7e]339 return new SizeofExpr( maybeMoveBuild< Expression >(expr_node) );
[a2e0687]340} // build_sizeOfexpr
341
342Expression * build_sizeOftype( DeclarationNode * decl_node ) {
[4f147cc]343 return new SizeofExpr( maybeMoveBuildType( decl_node ) );
[a2e0687]344} // build_sizeOftype
345
346Expression * build_alignOfexpr( ExpressionNode * expr_node ) {
[7ecbb7e]347 return new AlignofExpr( maybeMoveBuild< Expression >(expr_node) );
[a2e0687]348} // build_alignOfexpr
349
350Expression * build_alignOftype( DeclarationNode * decl_node ) {
[4f147cc]351 return new AlignofExpr( maybeMoveBuildType( decl_node) );
[a2e0687]352} // build_alignOftype
353
354Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member ) {
[a7c90d4]355 Expression * ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() );
[ac71a86]356 delete member;
357 return ret;
[a2e0687]358} // build_offsetOf
[064e3ff]359
[a2e0687]360Expression * build_and_or( ExpressionNode * expr_node1, ExpressionNode * expr_node2, bool kind ) {
[7ecbb7e]361 return new LogicalExpr( notZeroExpr( maybeMoveBuild< Expression >(expr_node1) ), notZeroExpr( maybeMoveBuild< Expression >(expr_node2) ), kind );
[a2e0687]362} // build_and_or
[51e076e]363
[a2e0687]364Expression * build_unary_val( OperKinds op, ExpressionNode * expr_node ) {
[7880579]365 std::list< Expression * > args;
[7ecbb7e]366 args.push_back( maybeMoveBuild< Expression >(expr_node) );
[d9e2280]367 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
[a2e0687]368} // build_unary_val
369
370Expression * build_unary_ptr( OperKinds op, ExpressionNode * expr_node ) {
[7880579]371 std::list< Expression * > args;
[cda7889]372 args.push_back( maybeMoveBuild< Expression >(expr_node) ); // xxx
[d9e2280]373 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
[a2e0687]374} // build_unary_ptr
375
376Expression * build_binary_val( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 ) {
[7880579]377 std::list< Expression * > args;
[7ecbb7e]378 args.push_back( maybeMoveBuild< Expression >(expr_node1) );
379 args.push_back( maybeMoveBuild< Expression >(expr_node2) );
[d9e2280]380 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
[a2e0687]381} // build_binary_val
382
383Expression * build_binary_ptr( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 ) {
[7880579]384 std::list< Expression * > args;
[cda7889]385 args.push_back( maybeMoveBuild< Expression >(expr_node1) );
[7ecbb7e]386 args.push_back( maybeMoveBuild< Expression >(expr_node2) );
[d9e2280]387 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
[a2e0687]388} // build_binary_ptr
[51e076e]389
[a2e0687]390Expression * build_cond( ExpressionNode * expr_node1, ExpressionNode * expr_node2, ExpressionNode * expr_node3 ) {
[7ecbb7e]391 return new ConditionalExpr( notZeroExpr( maybeMoveBuild< Expression >(expr_node1) ), maybeMoveBuild< Expression >(expr_node2), maybeMoveBuild< Expression >(expr_node3) );
[a2e0687]392} // build_cond
[51e076e]393
[a2e0687]394Expression * build_comma( ExpressionNode * expr_node1, ExpressionNode * expr_node2 ) {
[7ecbb7e]395 return new CommaExpr( maybeMoveBuild< Expression >(expr_node1), maybeMoveBuild< Expression >(expr_node2) );
[a2e0687]396} // build_comma
[51e076e]397
[a2e0687]398Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node ) {
[7ecbb7e]399 return new AttrExpr( var, maybeMoveBuild< Expression >(expr_node) );
[a2e0687]400} // build_attrexpr
401
402Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node ) {
[4f147cc]403 return new AttrExpr( var, maybeMoveBuildType( decl_node ) );
[a2e0687]404} // build_attrtype
[9706554]405
[a2e0687]406Expression * build_tuple( ExpressionNode * expr_node ) {
[907eccb]407 std::list< Expression * > exprs;
408 buildMoveList( expr_node, exprs );
409 return new UntypedTupleExpr( exprs );;
[a2e0687]410} // build_tuple
[9706554]411
[a2e0687]412Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node ) {
[7880579]413 std::list< Expression * > args;
[7ecbb7e]414 buildMoveList( expr_node, args );
415 return new UntypedExpr( maybeMoveBuild< Expression >(function), args, nullptr );
[a2e0687]416} // build_func
[9706554]417
[a2e0687]418Expression * build_range( ExpressionNode * low, ExpressionNode * high ) {
[7ecbb7e]419 return new RangeExpr( maybeMoveBuild< Expression >( low ), maybeMoveBuild< Expression >( high ) );
[a2e0687]420} // build_range
[51b73452]421
[a2e0687]422Expression * build_asmexpr( ExpressionNode * inout, ConstantExpr * constraint, ExpressionNode * operand ) {
[7ecbb7e]423 return new AsmExpr( maybeMoveBuild< Expression >( inout ), constraint, maybeMoveBuild< Expression >(operand) );
[a2e0687]424} // build_asmexpr
[7f5566b]425
[a2e0687]426Expression * build_valexpr( StatementNode * s ) {
[af5c204a]427 return new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(s) ) );
[a2e0687]428} // build_valexpr
429
430Expression * build_typevalue( DeclarationNode * decl ) {
[4f147cc]431 return new TypeExpr( maybeMoveBuildType( decl ) );
[a2e0687]432} // build_typevalue
[630a82a]433
[a2e0687]434Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids ) {
[7880579]435 Declaration * newDecl = maybeBuild< Declaration >(decl_node); // compound literal type
[630a82a]436 if ( DeclarationWithType * newDeclWithType = dynamic_cast< DeclarationWithType * >( newDecl ) ) { // non-sue compound-literal type
[7ecbb7e]437 return new CompoundLiteralExpr( newDeclWithType->get_type(), maybeMoveBuild< Initializer >(kids) );
[630a82a]438 // these types do not have associated type information
439 } else if ( StructDecl * newDeclStructDecl = dynamic_cast< StructDecl * >( newDecl ) ) {
[fbcde64]440 if ( newDeclStructDecl->has_body() ) {
441 return new CompoundLiteralExpr( new StructInstType( Type::Qualifiers(), newDeclStructDecl ), maybeMoveBuild< Initializer >(kids) );
442 } else {
443 return new CompoundLiteralExpr( new StructInstType( Type::Qualifiers(), newDeclStructDecl->get_name() ), maybeMoveBuild< Initializer >(kids) );
444 } // if
[630a82a]445 } else if ( UnionDecl * newDeclUnionDecl = dynamic_cast< UnionDecl * >( newDecl ) ) {
[fbcde64]446 if ( newDeclUnionDecl->has_body() ) {
447 return new CompoundLiteralExpr( new UnionInstType( Type::Qualifiers(), newDeclUnionDecl ), maybeMoveBuild< Initializer >(kids) );
448 } else {
449 return new CompoundLiteralExpr( new UnionInstType( Type::Qualifiers(), newDeclUnionDecl->get_name() ), maybeMoveBuild< Initializer >(kids) );
450 } // if
[630a82a]451 } else if ( EnumDecl * newDeclEnumDecl = dynamic_cast< EnumDecl * >( newDecl ) ) {
[fbcde64]452 if ( newDeclEnumDecl->has_body() ) {
453 return new CompoundLiteralExpr( new EnumInstType( Type::Qualifiers(), newDeclEnumDecl ), maybeMoveBuild< Initializer >(kids) );
454 } else {
455 return new CompoundLiteralExpr( new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ), maybeMoveBuild< Initializer >(kids) );
456 } // if
[630a82a]457 } else {
458 assert( false );
459 } // if
[a2e0687]460} // build_compoundLiteral
[630a82a]461
[b87a5ed]462// Local Variables: //
463// tab-width: 4 //
464// mode: c++ //
465// compile-command: "make install" //
466// End: //
Note: See TracBrowser for help on using the repository browser.