| OLD | NEW |
| 1 //===- NaClBitcodeReader.cpp ----------------------------------------------===// | 1 //===- NaClBitcodeReader.cpp ----------------------------------------------===// |
| 2 // Internal NaClBitcodeReader implementation | 2 // Internal NaClBitcodeReader implementation |
| 3 // | 3 // |
| 4 // The LLVM Compiler Infrastructure | 4 // The LLVM Compiler Infrastructure |
| 5 // | 5 // |
| 6 // This file is distributed under the University of Illinois Open Source | 6 // This file is distributed under the University of Illinois Open Source |
| 7 // License. See LICENSE.TXT for details. | 7 // License. See LICENSE.TXT for details. |
| 8 // | 8 // |
| 9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
| 10 | 10 |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 if (Record.size() < 1) | 473 if (Record.size() < 1) |
| 474 return Error("Invalid POINTER type record"); | 474 return Error("Invalid POINTER type record"); |
| 475 unsigned AddressSpace = 0; | 475 unsigned AddressSpace = 0; |
| 476 if (Record.size() == 2) | 476 if (Record.size() == 2) |
| 477 AddressSpace = Record[1]; | 477 AddressSpace = Record[1]; |
| 478 ResultTy = getTypeByID(Record[0]); | 478 ResultTy = getTypeByID(Record[0]); |
| 479 if (ResultTy == 0) return Error("invalid element type in pointer type"); | 479 if (ResultTy == 0) return Error("invalid element type in pointer type"); |
| 480 ResultTy = PointerType::get(ResultTy, AddressSpace); | 480 ResultTy = PointerType::get(ResultTy, AddressSpace); |
| 481 break; | 481 break; |
| 482 } | 482 } |
| 483 case naclbitc::TYPE_CODE_FUNCTION_OLD: { | |
| 484 // FIXME: attrid is dead, remove it in LLVM 4.0 | |
| 485 // FUNCTION: [vararg, attrid, retty, paramty x N] | |
| 486 if (Record.size() < 3) | |
| 487 return Error("Invalid FUNCTION type record"); | |
| 488 SmallVector<Type*, 8> ArgTys; | |
| 489 for (unsigned i = 3, e = Record.size(); i != e; ++i) { | |
| 490 if (Type *T = getTypeByID(Record[i])) | |
| 491 ArgTys.push_back(T); | |
| 492 else | |
| 493 break; | |
| 494 } | |
| 495 | |
| 496 ResultTy = getTypeByID(Record[2]); | |
| 497 if (ResultTy == 0 || ArgTys.size() < Record.size()-3) | |
| 498 return Error("invalid type in function type"); | |
| 499 | |
| 500 ResultTy = FunctionType::get(ResultTy, ArgTys, Record[0]); | |
| 501 break; | |
| 502 } | |
| 503 case naclbitc::TYPE_CODE_FUNCTION: { | 483 case naclbitc::TYPE_CODE_FUNCTION: { |
| 504 // FUNCTION: [vararg, retty, paramty x N] | 484 // FUNCTION: [vararg, retty, paramty x N] |
| 505 if (Record.size() < 2) | 485 if (Record.size() < 2) |
| 506 return Error("Invalid FUNCTION type record"); | 486 return Error("Invalid FUNCTION type record"); |
| 507 SmallVector<Type*, 8> ArgTys; | 487 SmallVector<Type*, 8> ArgTys; |
| 508 for (unsigned i = 2, e = Record.size(); i != e; ++i) { | 488 for (unsigned i = 2, e = Record.size(); i != e; ++i) { |
| 509 if (Type *T = getTypeByID(Record[i])) | 489 if (Type *T = getTypeByID(Record[i])) |
| 510 ArgTys.push_back(T); | 490 ArgTys.push_back(T); |
| 511 else | 491 else |
| 512 break; | 492 break; |
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 if (M->MaterializeAllPermanently(ErrMsg)) { | 2024 if (M->MaterializeAllPermanently(ErrMsg)) { |
| 2045 delete M; | 2025 delete M; |
| 2046 return 0; | 2026 return 0; |
| 2047 } | 2027 } |
| 2048 | 2028 |
| 2049 // TODO: Restore the use-lists to the in-memory state when the bitcode was | 2029 // TODO: Restore the use-lists to the in-memory state when the bitcode was |
| 2050 // written. We must defer until the Module has been fully materialized. | 2030 // written. We must defer until the Module has been fully materialized. |
| 2051 | 2031 |
| 2052 return M; | 2032 return M; |
| 2053 } | 2033 } |
| OLD | NEW |