| [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
|
|---|
| [097e2b0] | 11 | // Last Modified By : Peter A. Buhr
|
|---|
| [1b772749] | 12 | // Last Modified On : Fri Sep 16 16:27:44 2016
|
|---|
| 13 | // Update Count : 508
|
|---|
| [0caaa6a] | 14 | //
|
|---|
| [b87a5ed] | 15 |
|
|---|
| [51b73452] | 16 | #include <cassert>
|
|---|
| 17 | #include <cctype>
|
|---|
| [7bf7fb9] | 18 | #include <climits>
|
|---|
| 19 | #include <cstdio>
|
|---|
| [51b73452] | 20 | #include <algorithm>
|
|---|
| [59db689] | 21 | #include <sstream>
|
|---|
| [51b73452] | 22 |
|
|---|
| 23 | #include "ParseNode.h"
|
|---|
| [630a82a] | 24 | #include "TypeData.h"
|
|---|
| [51b73452] | 25 | #include "SynTree/Constant.h"
|
|---|
| 26 | #include "SynTree/Expression.h"
|
|---|
| [630a82a] | 27 | #include "SynTree/Declaration.h"
|
|---|
| [d3b7937] | 28 | #include "Common/UnimplementedError.h"
|
|---|
| [51b73452] | 29 | #include "parseutility.h"
|
|---|
| [d3b7937] | 30 | #include "Common/utility.h"
|
|---|
| [51b73452] | 31 |
|
|---|
| 32 | using namespace std;
|
|---|
| 33 |
|
|---|
| [cd623a4] | 34 | //##############################################################################
|
|---|
| 35 |
|
|---|
| [7bf7fb9] | 36 | // Difficult to separate extra parts of constants during lexing because actions are not allow in the middle of patterns:
|
|---|
| 37 | //
|
|---|
| 38 | // prefix action constant action suffix
|
|---|
| 39 | //
|
|---|
| 40 | // Alternatively, breaking a pattern using BEGIN does not work if the following pattern can be empty:
|
|---|
| 41 | //
|
|---|
| 42 | // constant BEGIN CONT ...
|
|---|
| 43 | // <CONT>(...)? BEGIN 0 ... // possible empty suffix
|
|---|
| 44 | //
|
|---|
| 45 | // because the CONT rule is NOT triggered if the pattern is empty. Hence, constants are reparsed here to determine their
|
|---|
| 46 | // type.
|
|---|
| 47 |
|
|---|
| 48 | static Type::Qualifiers emptyQualifiers; // no qualifiers on constants
|
|---|
| 49 |
|
|---|
| 50 | static inline bool checkU( char c ) { return c == 'u' || c == 'U'; }
|
|---|
| 51 | static inline bool checkL( char c ) { return c == 'l' || c == 'L'; }
|
|---|
| 52 | static inline bool checkF( char c ) { return c == 'f' || c == 'F'; }
|
|---|
| 53 | static inline bool checkD( char c ) { return c == 'd' || c == 'D'; }
|
|---|
| 54 | static inline bool checkI( char c ) { return c == 'i' || c == 'I'; }
|
|---|
| 55 | static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }
|
|---|
| 56 |
|
|---|
| [ac71a86] | 57 | Expression *build_constantInteger( const std::string & str ) {
|
|---|
| [7bf7fb9] | 58 | static const BasicType::Kind kind[2][3] = {
|
|---|
| 59 | { BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt },
|
|---|
| 60 | { BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt },
|
|---|
| 61 | };
|
|---|
| 62 | bool dec = true, Unsigned = false; // decimal, unsigned constant
|
|---|
| 63 | int size; // 0 => int, 1 => long, 2 => long long
|
|---|
| 64 | unsigned long long v; // converted integral value
|
|---|
| 65 | size_t last = str.length() - 1; // last character of constant
|
|---|
| 66 |
|
|---|
| 67 | if ( str[0] == '0' ) { // octal/hex constant ?
|
|---|
| 68 | dec = false;
|
|---|
| 69 | if ( last != 0 && checkX( str[1] ) ) { // hex constant ?
|
|---|
| 70 | sscanf( (char *)str.c_str(), "%llx", &v );
|
|---|
| 71 | //printf( "%llx %llu\n", v, v );
|
|---|
| 72 | } else { // octal constant
|
|---|
| 73 | sscanf( (char *)str.c_str(), "%llo", &v );
|
|---|
| 74 | //printf( "%llo %llu\n", v, v );
|
|---|
| 75 | } // if
|
|---|
| 76 | } else { // decimal constant ?
|
|---|
| 77 | sscanf( (char *)str.c_str(), "%llu", &v );
|
|---|
| 78 | //printf( "%llu %llu\n", v, v );
|
|---|
| 79 | } // if
|
|---|
| 80 |
|
|---|
| 81 | if ( v <= INT_MAX ) { // signed int
|
|---|
| 82 | size = 0;
|
|---|
| 83 | } else if ( v <= UINT_MAX && ! dec ) { // unsigned int
|
|---|
| 84 | size = 0;
|
|---|
| 85 | Unsigned = true; // unsigned
|
|---|
| 86 | } else if ( v <= LONG_MAX ) { // signed long int
|
|---|
| 87 | size = 1;
|
|---|
| 88 | } else if ( v <= ULONG_MAX && ( ! dec || LONG_MAX == LLONG_MAX ) ) { // signed long int
|
|---|
| 89 | size = 1;
|
|---|
| 90 | Unsigned = true; // unsigned long int
|
|---|
| 91 | } else if ( v <= LLONG_MAX ) { // signed long long int
|
|---|
| 92 | size = 2;
|
|---|
| 93 | } else { // unsigned long long int
|
|---|
| 94 | size = 2;
|
|---|
| 95 | Unsigned = true; // unsigned long long int
|
|---|
| 96 | } // if
|
|---|
| 97 |
|
|---|
| 98 | if ( checkU( str[last] ) ) { // suffix 'u' ?
|
|---|
| 99 | Unsigned = true;
|
|---|
| 100 | if ( last > 0 && checkL( str[last - 1] ) ) { // suffix 'l' ?
|
|---|
| 101 | size = 1;
|
|---|
| 102 | if ( last > 1 && checkL( str[last - 2] ) ) { // suffix 'll' ?
|
|---|
| 103 | size = 2;
|
|---|
| 104 | } // if
|
|---|
| 105 | } // if
|
|---|
| 106 | } else if ( checkL( str[ last ] ) ) { // suffix 'l' ?
|
|---|
| 107 | size = 1;
|
|---|
| 108 | if ( last > 0 && checkL( str[last - 1] ) ) { // suffix 'll' ?
|
|---|
| 109 | size = 2;
|
|---|
| 110 | if ( last > 1 && checkU( str[last - 2] ) ) { // suffix 'u' ?
|
|---|
| 111 | Unsigned = true;
|
|---|
| 112 | } // if
|
|---|
| 113 | } else {
|
|---|
| 114 | if ( last > 0 && checkU( str[last - 1] ) ) { // suffix 'u' ?
|
|---|
| 115 | Unsigned = true;
|
|---|
| 116 | } // if
|
|---|
| 117 | } // if
|
|---|
| 118 | } // if
|
|---|
| 119 |
|
|---|
| [ab57786] | 120 | Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str ) );
|
|---|
| 121 | delete &str; // created by lex
|
|---|
| 122 | return ret;
|
|---|
| [7bf7fb9] | 123 | } // build_constantInteger
|
|---|
| [51b73452] | 124 |
|
|---|
| [ac71a86] | 125 | Expression *build_constantFloat( const std::string & str ) {
|
|---|
| [7bf7fb9] | 126 | static const BasicType::Kind kind[2][3] = {
|
|---|
| 127 | { BasicType::Float, BasicType::Double, BasicType::LongDouble },
|
|---|
| 128 | { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex },
|
|---|
| 129 | };
|
|---|
| [59c24b6] | 130 |
|
|---|
| [7bf7fb9] | 131 | bool complx = false; // real, complex
|
|---|
| 132 | int size = 1; // 0 => float, 1 => double (default), 2 => long double
|
|---|
| 133 | // floating-point constant has minimum of 2 characters: 1. or .1
|
|---|
| 134 | size_t last = str.length() - 1;
|
|---|
| [51b73452] | 135 |
|
|---|
| [7bf7fb9] | 136 | if ( checkI( str[last] ) ) { // imaginary ?
|
|---|
| 137 | complx = true;
|
|---|
| 138 | last -= 1; // backup one character
|
|---|
| 139 | } // if
|
|---|
| [0caaa6a] | 140 |
|
|---|
| [7bf7fb9] | 141 | if ( checkF( str[last] ) ) { // float ?
|
|---|
| 142 | size = 0;
|
|---|
| 143 | } else if ( checkD( str[last] ) ) { // double ?
|
|---|
| 144 | size = 1;
|
|---|
| 145 | } else if ( checkL( str[last] ) ) { // long double ?
|
|---|
| 146 | size = 2;
|
|---|
| 147 | } // if
|
|---|
| 148 | if ( ! complx && checkI( str[last - 1] ) ) { // imaginary ?
|
|---|
| 149 | complx = true;
|
|---|
| 150 | } // if
|
|---|
| [51b73452] | 151 |
|
|---|
| [ab57786] | 152 | Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str ) );
|
|---|
| 153 | delete &str; // created by lex
|
|---|
| 154 | return ret;
|
|---|
| [7bf7fb9] | 155 | } // build_constantFloat
|
|---|
| [51b73452] | 156 |
|
|---|
| [ac71a86] | 157 | Expression *build_constantChar( const std::string & str ) {
|
|---|
| [ab57786] | 158 | Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str ) );
|
|---|
| 159 | delete &str; // created by lex
|
|---|
| 160 | return ret;
|
|---|
| [7bf7fb9] | 161 | } // build_constantChar
|
|---|
| [51b73452] | 162 |
|
|---|
| [ac71a86] | 163 | ConstantExpr *build_constantStr( const std::string & str ) {
|
|---|
| [7bf7fb9] | 164 | // string should probably be a primitive type
|
|---|
| 165 | ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( emptyQualifiers, BasicType::Char ),
|
|---|
| 166 | new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::UnsignedInt ),
|
|---|
| 167 | toString( str.size()+1-2 ) ) ), // +1 for '\0' and -2 for '"'
|
|---|
| 168 | false, false );
|
|---|
| [ab57786] | 169 | ConstantExpr * ret = new ConstantExpr( Constant( at, str ) );
|
|---|
| 170 | delete &str; // created by lex
|
|---|
| 171 | return ret;
|
|---|
| [7bf7fb9] | 172 | } // build_constantStr
|
|---|
| [51b73452] | 173 |
|
|---|
| [d1625f8] | 174 | NameExpr * build_varref( const string *name, bool labelp ) {
|
|---|
| [7ecbb7e] | 175 | NameExpr *expr = new NameExpr( *name, nullptr );
|
|---|
| 176 | delete name;
|
|---|
| 177 | return expr;
|
|---|
| [51b1202] | 178 | }
|
|---|
| 179 |
|
|---|
| [d9e2280] | 180 | static const char *OperName[] = {
|
|---|
| [5721a6d] | 181 | // diadic
|
|---|
| [7bf7fb9] | 182 | "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?*?", "?/?", "?%?", "||", "&&",
|
|---|
| [5721a6d] | 183 | "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?",
|
|---|
| [a839867] | 184 | "?=?", "?@=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
|
|---|
| [d9e2280] | 185 | "?[?]", "...",
|
|---|
| [5721a6d] | 186 | // monadic
|
|---|
| 187 | "+?", "-?", "AddressOf", "*?", "!?", "~?", "++?", "?++", "--?", "?--", "&&"
|
|---|
| 188 | };
|
|---|
| 189 |
|
|---|
| [d1625f8] | 190 | Expression *build_cast( DeclarationNode *decl_node, ExpressionNode *expr_node ) {
|
|---|
| [4f147cc] | 191 | Type *targetType = maybeMoveBuildType( decl_node );
|
|---|
| [d1625f8] | 192 | if ( dynamic_cast< VoidType * >( targetType ) ) {
|
|---|
| [064e3ff] | 193 | delete targetType;
|
|---|
| [7ecbb7e] | 194 | return new CastExpr( maybeMoveBuild< Expression >(expr_node) );
|
|---|
| [064e3ff] | 195 | } else {
|
|---|
| [7ecbb7e] | 196 | return new CastExpr( maybeMoveBuild< Expression >(expr_node), targetType );
|
|---|
| [064e3ff] | 197 | } // if
|
|---|
| 198 | }
|
|---|
| 199 |
|
|---|
| [3b58d91] | 200 | Expression *build_fieldSel( ExpressionNode *expr_node, Expression *member ) {
|
|---|
| 201 | UntypedMemberExpr *ret = new UntypedMemberExpr( member, maybeMoveBuild< Expression >(expr_node) );
|
|---|
| [064e3ff] | 202 | return ret;
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| [3b58d91] | 205 | Expression *build_pfieldSel( ExpressionNode *expr_node, Expression *member ) {
|
|---|
| [064e3ff] | 206 | UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
|
|---|
| [7ecbb7e] | 207 | deref->get_args().push_back( maybeMoveBuild< Expression >(expr_node) );
|
|---|
| [3b58d91] | 208 | UntypedMemberExpr *ret = new UntypedMemberExpr( member, deref );
|
|---|
| [064e3ff] | 209 | return ret;
|
|---|
| 210 | }
|
|---|
| 211 |
|
|---|
| 212 | Expression *build_addressOf( ExpressionNode *expr_node ) {
|
|---|
| [7ecbb7e] | 213 | return new AddressExpr( maybeMoveBuild< Expression >(expr_node) );
|
|---|
| [064e3ff] | 214 | }
|
|---|
| [d1625f8] | 215 | Expression *build_sizeOfexpr( ExpressionNode *expr_node ) {
|
|---|
| [7ecbb7e] | 216 | return new SizeofExpr( maybeMoveBuild< Expression >(expr_node) );
|
|---|
| [064e3ff] | 217 | }
|
|---|
| [d1625f8] | 218 | Expression *build_sizeOftype( DeclarationNode *decl_node ) {
|
|---|
| [4f147cc] | 219 | return new SizeofExpr( maybeMoveBuildType( decl_node ) );
|
|---|
| [d1625f8] | 220 | }
|
|---|
| 221 | Expression *build_alignOfexpr( ExpressionNode *expr_node ) {
|
|---|
| [7ecbb7e] | 222 | return new AlignofExpr( maybeMoveBuild< Expression >(expr_node) );
|
|---|
| [d1625f8] | 223 | }
|
|---|
| 224 | Expression *build_alignOftype( DeclarationNode *decl_node ) {
|
|---|
| [4f147cc] | 225 | return new AlignofExpr( maybeMoveBuildType( decl_node) );
|
|---|
| [064e3ff] | 226 | }
|
|---|
| [d1625f8] | 227 | Expression *build_offsetOf( DeclarationNode *decl_node, NameExpr *member ) {
|
|---|
| [4f147cc] | 228 | Expression* ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() );
|
|---|
| [ac71a86] | 229 | delete member;
|
|---|
| 230 | return ret;
|
|---|
| [064e3ff] | 231 | }
|
|---|
| 232 |
|
|---|
| [51e076e] | 233 | Expression *build_and_or( ExpressionNode *expr_node1, ExpressionNode *expr_node2, bool kind ) {
|
|---|
| [7ecbb7e] | 234 | return new LogicalExpr( notZeroExpr( maybeMoveBuild< Expression >(expr_node1) ), notZeroExpr( maybeMoveBuild< Expression >(expr_node2) ), kind );
|
|---|
| [51e076e] | 235 | }
|
|---|
| 236 |
|
|---|
| [d9e2280] | 237 | Expression *build_unary_val( OperKinds op, ExpressionNode *expr_node ) {
|
|---|
| [7880579] | 238 | std::list< Expression * > args;
|
|---|
| [7ecbb7e] | 239 | args.push_back( maybeMoveBuild< Expression >(expr_node) );
|
|---|
| [d9e2280] | 240 | return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
|
|---|
| [9706554] | 241 | }
|
|---|
| [d9e2280] | 242 | Expression *build_unary_ptr( OperKinds op, ExpressionNode *expr_node ) {
|
|---|
| [7880579] | 243 | std::list< Expression * > args;
|
|---|
| [7ecbb7e] | 244 | args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node) ) );
|
|---|
| [d9e2280] | 245 | return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
|
|---|
| [51e076e] | 246 | }
|
|---|
| [d9e2280] | 247 | Expression *build_binary_val( OperKinds op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) {
|
|---|
| [7880579] | 248 | std::list< Expression * > args;
|
|---|
| [7ecbb7e] | 249 | args.push_back( maybeMoveBuild< Expression >(expr_node1) );
|
|---|
| 250 | args.push_back( maybeMoveBuild< Expression >(expr_node2) );
|
|---|
| [d9e2280] | 251 | return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
|
|---|
| [51e076e] | 252 | }
|
|---|
| [d9e2280] | 253 | Expression *build_binary_ptr( OperKinds op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) {
|
|---|
| [7880579] | 254 | std::list< Expression * > args;
|
|---|
| [7ecbb7e] | 255 | args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node1) ) );
|
|---|
| 256 | args.push_back( maybeMoveBuild< Expression >(expr_node2) );
|
|---|
| [d9e2280] | 257 | return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
|
|---|
| [9706554] | 258 | }
|
|---|
| [51e076e] | 259 |
|
|---|
| 260 | Expression *build_cond( ExpressionNode *expr_node1, ExpressionNode *expr_node2, ExpressionNode *expr_node3 ) {
|
|---|
| [7ecbb7e] | 261 | return new ConditionalExpr( notZeroExpr( maybeMoveBuild< Expression >(expr_node1) ), maybeMoveBuild< Expression >(expr_node2), maybeMoveBuild< Expression >(expr_node3) );
|
|---|
| [51e076e] | 262 | }
|
|---|
| 263 |
|
|---|
| 264 | Expression *build_comma( ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) {
|
|---|
| [7ecbb7e] | 265 | return new CommaExpr( maybeMoveBuild< Expression >(expr_node1), maybeMoveBuild< Expression >(expr_node2) );
|
|---|
| [51e076e] | 266 | }
|
|---|
| 267 |
|
|---|
| [d1625f8] | 268 | Expression *build_attrexpr( NameExpr *var, ExpressionNode * expr_node ) {
|
|---|
| [7ecbb7e] | 269 | return new AttrExpr( var, maybeMoveBuild< Expression >(expr_node) );
|
|---|
| [d1625f8] | 270 | }
|
|---|
| 271 | Expression *build_attrtype( NameExpr *var, DeclarationNode * decl_node ) {
|
|---|
| [4f147cc] | 272 | return new AttrExpr( var, maybeMoveBuildType( decl_node ) );
|
|---|
| [9706554] | 273 | }
|
|---|
| 274 |
|
|---|
| [d1625f8] | 275 | Expression *build_tuple( ExpressionNode * expr_node ) {
|
|---|
| [9706554] | 276 | TupleExpr *ret = new TupleExpr();
|
|---|
| [7ecbb7e] | 277 | buildMoveList( expr_node, ret->get_exprs() );
|
|---|
| [9706554] | 278 | return ret;
|
|---|
| 279 | }
|
|---|
| 280 |
|
|---|
| [d1625f8] | 281 | Expression *build_func( ExpressionNode * function, ExpressionNode * expr_node ) {
|
|---|
| [7880579] | 282 | std::list< Expression * > args;
|
|---|
| [7ecbb7e] | 283 | buildMoveList( expr_node, args );
|
|---|
| 284 | return new UntypedExpr( maybeMoveBuild< Expression >(function), args, nullptr );
|
|---|
| [9706554] | 285 | }
|
|---|
| 286 |
|
|---|
| [d9e2280] | 287 | Expression *build_range( ExpressionNode * low, ExpressionNode *high ) {
|
|---|
| [7ecbb7e] | 288 | return new RangeExpr( maybeMoveBuild< Expression >( low ), maybeMoveBuild< Expression >( high ) );
|
|---|
| [51b73452] | 289 | }
|
|---|
| 290 |
|
|---|
| [e82aa9df] | 291 | Expression *build_asmexpr( ExpressionNode *inout, ConstantExpr *constraint, ExpressionNode *operand ) {
|
|---|
| [7ecbb7e] | 292 | return new AsmExpr( maybeMoveBuild< Expression >( inout ), constraint, maybeMoveBuild< Expression >(operand) );
|
|---|
| [7f5566b] | 293 | }
|
|---|
| 294 |
|
|---|
| [d1625f8] | 295 | Expression *build_valexpr( StatementNode *s ) {
|
|---|
| [7ecbb7e] | 296 | return new UntypedValofExpr( maybeMoveBuild< Statement >(s), nullptr );
|
|---|
| [3848e0e] | 297 | }
|
|---|
| [d1625f8] | 298 | Expression *build_typevalue( DeclarationNode *decl ) {
|
|---|
| [4f147cc] | 299 | return new TypeExpr( maybeMoveBuildType( decl ) );
|
|---|
| [630a82a] | 300 | }
|
|---|
| 301 |
|
|---|
| [d1625f8] | 302 | Expression *build_compoundLiteral( DeclarationNode *decl_node, InitializerNode *kids ) {
|
|---|
| [7880579] | 303 | Declaration * newDecl = maybeBuild< Declaration >(decl_node); // compound literal type
|
|---|
| [630a82a] | 304 | if ( DeclarationWithType * newDeclWithType = dynamic_cast< DeclarationWithType * >( newDecl ) ) { // non-sue compound-literal type
|
|---|
| [7ecbb7e] | 305 | return new CompoundLiteralExpr( newDeclWithType->get_type(), maybeMoveBuild< Initializer >(kids) );
|
|---|
| [630a82a] | 306 | // these types do not have associated type information
|
|---|
| 307 | } else if ( StructDecl * newDeclStructDecl = dynamic_cast< StructDecl * >( newDecl ) ) {
|
|---|
| [7ecbb7e] | 308 | return new CompoundLiteralExpr( new StructInstType( Type::Qualifiers(), newDeclStructDecl->get_name() ), maybeMoveBuild< Initializer >(kids) );
|
|---|
| [630a82a] | 309 | } else if ( UnionDecl * newDeclUnionDecl = dynamic_cast< UnionDecl * >( newDecl ) ) {
|
|---|
| [7ecbb7e] | 310 | return new CompoundLiteralExpr( new UnionInstType( Type::Qualifiers(), newDeclUnionDecl->get_name() ), maybeMoveBuild< Initializer >(kids) );
|
|---|
| [630a82a] | 311 | } else if ( EnumDecl * newDeclEnumDecl = dynamic_cast< EnumDecl * >( newDecl ) ) {
|
|---|
| [7ecbb7e] | 312 | return new CompoundLiteralExpr( new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ), maybeMoveBuild< Initializer >(kids) );
|
|---|
| [630a82a] | 313 | } else {
|
|---|
| 314 | assert( false );
|
|---|
| 315 | } // if
|
|---|
| 316 | }
|
|---|
| 317 |
|
|---|
| [b87a5ed] | 318 | // Local Variables: //
|
|---|
| 319 | // tab-width: 4 //
|
|---|
| 320 | // mode: c++ //
|
|---|
| 321 | // compile-command: "make install" //
|
|---|
| 322 | // End: //
|
|---|