Changeset 761:fa306ca8843b
- Timestamp:
- 11/11/08 20:30:28
(2 months ago)
- Author:
- Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
- branch:
- default
- Message:
Applied fvbommel's patch from #112
Added missing TypeInfoInvariant? codegen for D2
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r741 |
r761 |
|
| 1614 | 1614 | int count; |
|---|
| 1615 | 1615 | |
|---|
| | 1616 | // On some platforms (i.e. x86_64) va_list is an array and thus passed by |
|---|
| | 1617 | // reference. Copy the input list so we can copy it back before retrying. |
|---|
| | 1618 | va_list orig_args; |
|---|
| | 1619 | va_copy(orig_args, args); |
|---|
| | 1620 | |
|---|
| 1616 | 1621 | p = buffer; |
|---|
| 1617 | 1622 | psize = sizeof(buffer); |
|---|
| … | … | |
| 1623 | 1628 | break; |
|---|
| 1624 | 1629 | psize *= 2; |
|---|
| 1625 | | #endif |
|---|
| 1626 | | #if POSIX |
|---|
| | 1630 | #elif POSIX |
|---|
| 1627 | 1631 | count = vsnprintf(p,psize,format,args); |
|---|
| 1628 | 1632 | if (count == -1) |
|---|
| … | … | |
| 1633 | 1637 | break; |
|---|
| 1634 | 1638 | #endif |
|---|
| | 1639 | va_copy(args, orig_args); |
|---|
| 1635 | 1640 | p = (char *) alloca(psize); // buffer too small, try again with larger size |
|---|
| 1636 | 1641 | } |
|---|
| r758 |
r761 |
|
| 1614 | 1614 | int count; |
|---|
| 1615 | 1615 | |
|---|
| | 1616 | // On some platforms (i.e. x86_64) va_list is an array and thus passed by |
|---|
| | 1617 | // reference. Copy the input list so we can copy it back before retrying. |
|---|
| | 1618 | va_list orig_args; |
|---|
| | 1619 | va_copy(orig_args, args); |
|---|
| | 1620 | |
|---|
| 1616 | 1621 | p = buffer; |
|---|
| 1617 | 1622 | psize = sizeof(buffer); |
|---|
| … | … | |
| 1623 | 1628 | break; |
|---|
| 1624 | 1629 | psize *= 2; |
|---|
| 1625 | | #endif |
|---|
| 1626 | | #if POSIX |
|---|
| | 1630 | #elif POSIX |
|---|
| 1627 | 1631 | count = vsnprintf(p,psize,format,args); |
|---|
| 1628 | 1632 | if (count == -1) |
|---|
| … | … | |
| 1633 | 1637 | break; |
|---|
| 1634 | 1638 | #endif |
|---|
| | 1639 | va_copy(args, orig_args); |
|---|
| 1635 | 1640 | p = (char *) alloca(psize); // buffer too small, try again with larger size |
|---|
| 1636 | 1641 | } |
|---|
| r758 |
r761 |
|
| 1230 | 1230 | } |
|---|
| 1231 | 1231 | |
|---|
| 1232 | | // void TypeInfoConstDeclaration::toDt(dt_t **pdt) |
|---|
| 1233 | | // { |
|---|
| 1234 | | // //printf("TypeInfoConstDeclaration::toDt() %s\n", toChars()); |
|---|
| 1235 | | // dtxoff(pdt, Type::typeinfoconst->toVtblSymbol(), 0, TYnptr); // vtbl for TypeInfo_Const |
|---|
| 1236 | | // dtdword(pdt, 0); // monitor |
|---|
| 1237 | | // Type *tm = tinfo->mutableOf(); |
|---|
| 1238 | | // tm = tm->merge(); |
|---|
| 1239 | | // tm->getTypeInfo(NULL); |
|---|
| 1240 | | // dtxoff(pdt, tm->vtinfo->toSymbol(), 0, TYnptr); |
|---|
| 1241 | | // } |
|---|
| 1242 | | |
|---|
| 1243 | 1232 | /////////////////////////////////////////////////////////// |
|---|
| 1244 | 1233 | |
|---|
| 1245 | 1234 | /* ========================================================================= */ |
|---|
| 1246 | 1235 | |
|---|
| | 1236 | void TypeInfoInvariantDeclaration::llvmDeclare() |
|---|
| | 1237 | { |
|---|
| | 1238 | Logger::println("TypeInfoInvariantDeclaration::toDt() %s", toChars()); |
|---|
| | 1239 | LOG_SCOPE; |
|---|
| | 1240 | |
|---|
| | 1241 | LLVM_D_Declare_TypeInfoBase(this, Type::typeinfoinvariant); |
|---|
| | 1242 | } |
|---|
| | 1243 | |
|---|
| | 1244 | void TypeInfoInvariantDeclaration::llvmDefine() |
|---|
| | 1245 | { |
|---|
| | 1246 | Logger::println("TypeInfoInvariantDeclaration::toDt() %s", toChars()); |
|---|
| | 1247 | LOG_SCOPE; |
|---|
| | 1248 | |
|---|
| | 1249 | Type *tm = tinfo->mutableOf(); |
|---|
| | 1250 | tm = tm->merge(); |
|---|
| | 1251 | |
|---|
| | 1252 | LLVM_D_Define_TypeInfoBase(tm, this, Type::typeinfoinvariant); |
|---|
| | 1253 | } |
|---|
| | 1254 | |
|---|
| 1247 | 1255 | void TypeInfoInvariantDeclaration::toDt(dt_t **pdt) |
|---|
| 1248 | 1256 | { |
|---|
| 1249 | | assert(0 && "TypeInfoInvariantDeclaration::toDt"); |
|---|
| 1250 | | } |
|---|
| 1251 | | |
|---|
| 1252 | | void TypeInfoInvariantDeclaration::llvmDeclare() |
|---|
| 1253 | | { |
|---|
| 1254 | | assert(0 && "TypeInfoInvariantDeclaration::llvmDeclare"); |
|---|
| 1255 | | } |
|---|
| 1256 | | |
|---|
| 1257 | | void TypeInfoInvariantDeclaration::llvmDefine() |
|---|
| 1258 | | { |
|---|
| 1259 | | assert(0 && "TypeInfoInvariantDeclaration::llvmDeclare"); |
|---|
| 1260 | | } |
|---|
| 1261 | | |
|---|
| 1262 | | // void TypeInfoInvariantDeclaration::toDt(dt_t **pdt) |
|---|
| 1263 | | // { |
|---|
| 1264 | | // //printf("TypeInfoInvariantDeclaration::toDt() %s\n", toChars()); |
|---|
| 1265 | | // dtxoff(pdt, Type::typeinfoinvariant->toVtblSymbol(), 0, TYnptr); // vtbl for TypeInfo_Invariant |
|---|
| 1266 | | // dtdword(pdt, 0); // monitor |
|---|
| 1267 | | // Type *tm = tinfo->mutableOf(); |
|---|
| 1268 | | // tm = tm->merge(); |
|---|
| 1269 | | // tm->getTypeInfo(NULL); |
|---|
| 1270 | | // dtxoff(pdt, tm->vtinfo->toSymbol(), 0, TYnptr); |
|---|
| 1271 | | // } |
|---|
| | 1257 | assert(0); |
|---|
| | 1258 | } |
|---|
| 1272 | 1259 | |
|---|
| 1273 | 1260 | #endif |
|---|