~ubuntu-branches/ubuntu/maverick/aspectc++/maverick

« back to all changes in this revision

Viewing changes to Puma/gen-release/step2/src/CCConversions.cc

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
  if (t->isInteger ()) {
42
42
    if (t->is_char () || t->is_signed_char () || t->is_unsigned_char () ||
43
43
        t->is_short () || t->is_unsigned_short () || t->is_wchar_t () || 
44
 
        t->isEnum () || t->is_bool ())
 
44
        t->is_bool ())
45
45
      return &CTYPE_INT;
 
46
    else if (t->isEnum ())
 
47
      return t->VirtualType ()->TypeEnum ()->UnderlyingType ();
46
48
    else if (t->isBitField () && t->BaseType ()->isInteger () &&
47
49
             (*t->BaseType ()->UnqualType () < CTYPE_INT))
48
50
      return &CTYPE_INT;
183
185
    seq->addConversion (new CCIdentityConv (param, arg, arg_expr, base));
184
186
    CTypeInfo::Destroy (arg);
185
187
    return seq;
186
 
  }
 
188
  } 
187
189
 
188
190
  // �4.12 boolean conversion 
189
191
  if (param->is_bool () && arg->isScalar ()) {
191
193
  // �4.5 integral promotions
192
194
  } else if (arg->isInteger () && param->isInteger ()) {
193
195
    // promote only if argument type is less precise than parameter type
194
 
    if (*param == CTYPE_INT && arg->rank () <= CTYPE_INT.rank ()) {
 
196
    if (*param == CTYPE_INT && arg->rank () <= CTYPE_WCHAR_T.rank ()) {
195
197
      arg = &CTYPE_INT;
196
198
      seq->addConversion (new CCIntegralPromotion (param, arg, arg_expr, base)); conv = true;
 
199
    // promote enumeration type
 
200
    } else if (arg->isEnum () && *param == *arg->VirtualType ()->TypeEnum ()->UnderlyingType ()) {
 
201
      arg = param;
 
202
      seq->addConversion (new CCIntegralPromotion (param, arg, arg_expr, base)); conv = true;
197
203
    // �4.7 integral conversion
198
 
    } else {
 
204
    } else if (! param->isEnum ()) {
199
205
      seq->addConversion (new CCIntegralConv (param, arg, arg_expr, base)); conv = true;
200
206
    }
201
207
  // �4.6 floating point promotion
214
220
  // �4.10 pointer conversions
215
221
  } else if (param->isPointer () && (arg->isPointer () || arg->isInteger ())) {
216
222
    CClassInfo *ci1, *ci2;
217
 
    bool null_ptr = (arg_expr && 
218
 
                     arg_expr->Value () && 
 
223
    bool null_ptr = (! is_lvalue && arg_expr && arg_expr->Value () && 
219
224
                     arg_expr->Value ()->Constant () && 
220
 
                     arg_expr->Value ()->Constant ()->isNull ());
 
225
                     arg_expr->Value ()->Constant ()->isNull ());
221
226
    if (! param->isMemberPointer () && (null_ptr || 
222
227
        (arg->isPointer () && ! arg->isMemberPointer ()))) {
223
228
      if (null_ptr && (! arg->isPointer () || similarTypes (param, arg))) {
234
239
        seq->addConversion (new CCPointerConv (param, arg, arg_expr, base)); conv = true;
235
240
      } else if (param->BaseType ()->UnqualType ()->TypeClass () &&
236
241
                 arg->BaseType ()->UnqualType ()->TypeClass ()) {
237
 
        ci1 = param->BaseType ()->UnqualType ()->TypeClass ()->ClassInfo ();
238
 
        ci2 = arg->BaseType ()->UnqualType ()->TypeClass ()->ClassInfo ();
239
 
        if (baseClass (ci1, ci2)) {
240
 
          seq->addConversion (new CCPointerConv (param, arg, arg_expr, base)); conv = true;
241
 
        }
 
242
        ci1 = param->BaseType ()->UnqualType ()->TypeClass ()->ClassInfo ();
 
243
        ci2 = arg->BaseType ()->UnqualType ()->TypeClass ()->ClassInfo ();
 
244
        if (baseClass (ci1, ci2)) {
 
245
          seq->addConversion (new CCPointerConv (param, arg, arg_expr, base)); conv = true;
 
246
        }
242
247
      }
243
248
    // �4.11 pointer to member conversion
244
249
    } else if (param->isMemberPointer () && (null_ptr || arg->isMemberPointer ())) {
248
253
                 arg->TypeMemberPointer ()->Record ()) { 
249
254
        ci1 = param->TypeMemberPointer ()->Record ()->ClassInfo ();
250
255
        ci2 = arg->TypeMemberPointer ()->Record ()->ClassInfo ();
251
 
        if (baseClass (ci2, ci1) && *param->BaseType () == *arg->BaseType ()) {
252
 
          seq->addConversion (new CCPointerToMemberConv (param, arg, arg_expr, base)); conv = true;
253
 
        }
 
256
        if (baseClass (ci2, ci1) && *param->BaseType () == *arg->BaseType ()) {
 
257
          seq->addConversion (new CCPointerToMemberConv (param, arg, arg_expr, base)); conv = true;
 
258
        }
254
259
      }
255
260
    }
256
261
  }