mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-18 11:24:01 +00:00
Remove 'using std::errro_code' from lib.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210871 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -26,7 +26,6 @@
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
using std::error_code;
|
||||
|
||||
enum {
|
||||
SWITCH_INST_MAGIC = 0x4B5 // May 2012 => 1205 => Hex
|
||||
@ -471,7 +470,7 @@ static void decodeLLVMAttributesForBitcode(AttrBuilder &B,
|
||||
(EncodedAttrs & 0xffff));
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseAttributeBlock() {
|
||||
std::error_code BitcodeReader::ParseAttributeBlock() {
|
||||
if (Stream.EnterSubBlock(bitc::PARAMATTR_BLOCK_ID))
|
||||
return Error(InvalidRecord);
|
||||
|
||||
@ -491,7 +490,7 @@ error_code BitcodeReader::ParseAttributeBlock() {
|
||||
case BitstreamEntry::Error:
|
||||
return Error(MalformedBlock);
|
||||
case BitstreamEntry::EndBlock:
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
@ -617,15 +616,15 @@ static Attribute::AttrKind GetAttrFromCode(uint64_t Code) {
|
||||
}
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseAttrKind(uint64_t Code,
|
||||
Attribute::AttrKind *Kind) {
|
||||
std::error_code BitcodeReader::ParseAttrKind(uint64_t Code,
|
||||
Attribute::AttrKind *Kind) {
|
||||
*Kind = GetAttrFromCode(Code);
|
||||
if (*Kind == Attribute::None)
|
||||
return Error(InvalidValue);
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseAttributeGroupBlock() {
|
||||
std::error_code BitcodeReader::ParseAttributeGroupBlock() {
|
||||
if (Stream.EnterSubBlock(bitc::PARAMATTR_GROUP_BLOCK_ID))
|
||||
return Error(InvalidRecord);
|
||||
|
||||
@ -643,7 +642,7 @@ error_code BitcodeReader::ParseAttributeGroupBlock() {
|
||||
case BitstreamEntry::Error:
|
||||
return Error(MalformedBlock);
|
||||
case BitstreamEntry::EndBlock:
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
@ -665,13 +664,13 @@ error_code BitcodeReader::ParseAttributeGroupBlock() {
|
||||
for (unsigned i = 2, e = Record.size(); i != e; ++i) {
|
||||
if (Record[i] == 0) { // Enum attribute
|
||||
Attribute::AttrKind Kind;
|
||||
if (error_code EC = ParseAttrKind(Record[++i], &Kind))
|
||||
if (std::error_code EC = ParseAttrKind(Record[++i], &Kind))
|
||||
return EC;
|
||||
|
||||
B.addAttribute(Kind);
|
||||
} else if (Record[i] == 1) { // Align attribute
|
||||
Attribute::AttrKind Kind;
|
||||
if (error_code EC = ParseAttrKind(Record[++i], &Kind))
|
||||
if (std::error_code EC = ParseAttrKind(Record[++i], &Kind))
|
||||
return EC;
|
||||
if (Kind == Attribute::Alignment)
|
||||
B.addAlignmentAttr(Record[++i]);
|
||||
@ -707,14 +706,14 @@ error_code BitcodeReader::ParseAttributeGroupBlock() {
|
||||
}
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseTypeTable() {
|
||||
std::error_code BitcodeReader::ParseTypeTable() {
|
||||
if (Stream.EnterSubBlock(bitc::TYPE_BLOCK_ID_NEW))
|
||||
return Error(InvalidRecord);
|
||||
|
||||
return ParseTypeTableBody();
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseTypeTableBody() {
|
||||
std::error_code BitcodeReader::ParseTypeTableBody() {
|
||||
if (!TypeList.empty())
|
||||
return Error(InvalidMultipleBlocks);
|
||||
|
||||
@ -734,7 +733,7 @@ error_code BitcodeReader::ParseTypeTableBody() {
|
||||
case BitstreamEntry::EndBlock:
|
||||
if (NumRecords != TypeList.size())
|
||||
return Error(MalformedBlock);
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
@ -934,7 +933,7 @@ error_code BitcodeReader::ParseTypeTableBody() {
|
||||
}
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseValueSymbolTable() {
|
||||
std::error_code BitcodeReader::ParseValueSymbolTable() {
|
||||
if (Stream.EnterSubBlock(bitc::VALUE_SYMTAB_BLOCK_ID))
|
||||
return Error(InvalidRecord);
|
||||
|
||||
@ -950,7 +949,7 @@ error_code BitcodeReader::ParseValueSymbolTable() {
|
||||
case BitstreamEntry::Error:
|
||||
return Error(MalformedBlock);
|
||||
case BitstreamEntry::EndBlock:
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
@ -988,7 +987,7 @@ error_code BitcodeReader::ParseValueSymbolTable() {
|
||||
}
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseMetadata() {
|
||||
std::error_code BitcodeReader::ParseMetadata() {
|
||||
unsigned NextMDValueNo = MDValueList.size();
|
||||
|
||||
if (Stream.EnterSubBlock(bitc::METADATA_BLOCK_ID))
|
||||
@ -1005,7 +1004,7 @@ error_code BitcodeReader::ParseMetadata() {
|
||||
case BitstreamEntry::Error:
|
||||
return Error(MalformedBlock);
|
||||
case BitstreamEntry::EndBlock:
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
@ -1099,7 +1098,7 @@ uint64_t BitcodeReader::decodeSignRotatedValue(uint64_t V) {
|
||||
|
||||
/// ResolveGlobalAndAliasInits - Resolve all of the initializers for global
|
||||
/// values and aliases that we can.
|
||||
error_code BitcodeReader::ResolveGlobalAndAliasInits() {
|
||||
std::error_code BitcodeReader::ResolveGlobalAndAliasInits() {
|
||||
std::vector<std::pair<GlobalVariable*, unsigned> > GlobalInitWorklist;
|
||||
std::vector<std::pair<GlobalAlias*, unsigned> > AliasInitWorklist;
|
||||
std::vector<std::pair<Function*, unsigned> > FunctionPrefixWorklist;
|
||||
@ -1148,7 +1147,7 @@ error_code BitcodeReader::ResolveGlobalAndAliasInits() {
|
||||
FunctionPrefixWorklist.pop_back();
|
||||
}
|
||||
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
static APInt ReadWideAPInt(ArrayRef<uint64_t> Vals, unsigned TypeBits) {
|
||||
@ -1159,7 +1158,7 @@ static APInt ReadWideAPInt(ArrayRef<uint64_t> Vals, unsigned TypeBits) {
|
||||
return APInt(TypeBits, Words);
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseConstants() {
|
||||
std::error_code BitcodeReader::ParseConstants() {
|
||||
if (Stream.EnterSubBlock(bitc::CONSTANTS_BLOCK_ID))
|
||||
return Error(InvalidRecord);
|
||||
|
||||
@ -1182,7 +1181,7 @@ error_code BitcodeReader::ParseConstants() {
|
||||
// Once all the constants have been read, go through and resolve forward
|
||||
// references.
|
||||
ValueList.ResolveConstantForwardRefs();
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
@ -1597,7 +1596,7 @@ error_code BitcodeReader::ParseConstants() {
|
||||
}
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseUseLists() {
|
||||
std::error_code BitcodeReader::ParseUseLists() {
|
||||
if (Stream.EnterSubBlock(bitc::USELIST_BLOCK_ID))
|
||||
return Error(InvalidRecord);
|
||||
|
||||
@ -1612,7 +1611,7 @@ error_code BitcodeReader::ParseUseLists() {
|
||||
case BitstreamEntry::Error:
|
||||
return Error(MalformedBlock);
|
||||
case BitstreamEntry::EndBlock:
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
@ -1637,7 +1636,7 @@ error_code BitcodeReader::ParseUseLists() {
|
||||
/// RememberAndSkipFunctionBody - When we see the block for a function body,
|
||||
/// remember where it is and then skip it. This lets us lazily deserialize the
|
||||
/// functions.
|
||||
error_code BitcodeReader::RememberAndSkipFunctionBody() {
|
||||
std::error_code BitcodeReader::RememberAndSkipFunctionBody() {
|
||||
// Get the function we are talking about.
|
||||
if (FunctionsWithBodies.empty())
|
||||
return Error(InsufficientFunctionProtos);
|
||||
@ -1652,10 +1651,10 @@ error_code BitcodeReader::RememberAndSkipFunctionBody() {
|
||||
// Skip over the function block for now.
|
||||
if (Stream.SkipBlock())
|
||||
return Error(InvalidRecord);
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
error_code BitcodeReader::GlobalCleanup() {
|
||||
std::error_code BitcodeReader::GlobalCleanup() {
|
||||
// Patch the initializers for globals and aliases up.
|
||||
ResolveGlobalAndAliasInits();
|
||||
if (!GlobalInits.empty() || !AliasInits.empty())
|
||||
@ -1681,10 +1680,10 @@ error_code BitcodeReader::GlobalCleanup() {
|
||||
// want lazy deserialization.
|
||||
std::vector<std::pair<GlobalVariable*, unsigned> >().swap(GlobalInits);
|
||||
std::vector<std::pair<GlobalAlias*, unsigned> >().swap(AliasInits);
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
std::error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
if (Resume)
|
||||
Stream.JumpToBit(NextUnreadBit);
|
||||
else if (Stream.EnterSubBlock(bitc::MODULE_BLOCK_ID))
|
||||
@ -1715,30 +1714,30 @@ error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
return Error(MalformedBlock);
|
||||
break;
|
||||
case bitc::PARAMATTR_BLOCK_ID:
|
||||
if (error_code EC = ParseAttributeBlock())
|
||||
if (std::error_code EC = ParseAttributeBlock())
|
||||
return EC;
|
||||
break;
|
||||
case bitc::PARAMATTR_GROUP_BLOCK_ID:
|
||||
if (error_code EC = ParseAttributeGroupBlock())
|
||||
if (std::error_code EC = ParseAttributeGroupBlock())
|
||||
return EC;
|
||||
break;
|
||||
case bitc::TYPE_BLOCK_ID_NEW:
|
||||
if (error_code EC = ParseTypeTable())
|
||||
if (std::error_code EC = ParseTypeTable())
|
||||
return EC;
|
||||
break;
|
||||
case bitc::VALUE_SYMTAB_BLOCK_ID:
|
||||
if (error_code EC = ParseValueSymbolTable())
|
||||
if (std::error_code EC = ParseValueSymbolTable())
|
||||
return EC;
|
||||
SeenValueSymbolTable = true;
|
||||
break;
|
||||
case bitc::CONSTANTS_BLOCK_ID:
|
||||
if (error_code EC = ParseConstants())
|
||||
if (std::error_code EC = ParseConstants())
|
||||
return EC;
|
||||
if (error_code EC = ResolveGlobalAndAliasInits())
|
||||
if (std::error_code EC = ResolveGlobalAndAliasInits())
|
||||
return EC;
|
||||
break;
|
||||
case bitc::METADATA_BLOCK_ID:
|
||||
if (error_code EC = ParseMetadata())
|
||||
if (std::error_code EC = ParseMetadata())
|
||||
return EC;
|
||||
break;
|
||||
case bitc::FUNCTION_BLOCK_ID:
|
||||
@ -1746,12 +1745,12 @@ error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
// FunctionsWithBodies list.
|
||||
if (!SeenFirstFunctionBody) {
|
||||
std::reverse(FunctionsWithBodies.begin(), FunctionsWithBodies.end());
|
||||
if (error_code EC = GlobalCleanup())
|
||||
if (std::error_code EC = GlobalCleanup())
|
||||
return EC;
|
||||
SeenFirstFunctionBody = true;
|
||||
}
|
||||
|
||||
if (error_code EC = RememberAndSkipFunctionBody())
|
||||
if (std::error_code EC = RememberAndSkipFunctionBody())
|
||||
return EC;
|
||||
// For streaming bitcode, suspend parsing when we reach the function
|
||||
// bodies. Subsequent materialization calls will resume it when
|
||||
@ -1761,11 +1760,11 @@ error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
// just finish the parse now.
|
||||
if (LazyStreamer && SeenValueSymbolTable) {
|
||||
NextUnreadBit = Stream.GetCurrentBitNo();
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
break;
|
||||
case bitc::USELIST_BLOCK_ID:
|
||||
if (error_code EC = ParseUseLists())
|
||||
if (std::error_code EC = ParseUseLists())
|
||||
return EC;
|
||||
break;
|
||||
}
|
||||
@ -2007,10 +2006,10 @@ error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
}
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseBitcodeInto(Module *M) {
|
||||
std::error_code BitcodeReader::ParseBitcodeInto(Module *M) {
|
||||
TheModule = nullptr;
|
||||
|
||||
if (error_code EC = InitStream())
|
||||
if (std::error_code EC = InitStream())
|
||||
return EC;
|
||||
|
||||
// Sniff for the signature.
|
||||
@ -2026,7 +2025,7 @@ error_code BitcodeReader::ParseBitcodeInto(Module *M) {
|
||||
// need to understand them all.
|
||||
while (1) {
|
||||
if (Stream.AtEndOfStream())
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
|
||||
BitstreamEntry Entry =
|
||||
Stream.advance(BitstreamCursor::AF_DontAutoprocessAbbrevs);
|
||||
@ -2035,7 +2034,7 @@ error_code BitcodeReader::ParseBitcodeInto(Module *M) {
|
||||
case BitstreamEntry::Error:
|
||||
return Error(MalformedBlock);
|
||||
case BitstreamEntry::EndBlock:
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
|
||||
case BitstreamEntry::SubBlock:
|
||||
switch (Entry.ID) {
|
||||
@ -2048,10 +2047,10 @@ error_code BitcodeReader::ParseBitcodeInto(Module *M) {
|
||||
if (TheModule)
|
||||
return Error(InvalidMultipleBlocks);
|
||||
TheModule = M;
|
||||
if (error_code EC = ParseModule(false))
|
||||
if (std::error_code EC = ParseModule(false))
|
||||
return EC;
|
||||
if (LazyStreamer)
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
break;
|
||||
default:
|
||||
if (Stream.SkipBlock())
|
||||
@ -2068,14 +2067,14 @@ error_code BitcodeReader::ParseBitcodeInto(Module *M) {
|
||||
if (Stream.getAbbrevIDWidth() == 2 && Entry.ID == 2 &&
|
||||
Stream.Read(6) == 2 && Stream.Read(24) == 0xa0a0a &&
|
||||
Stream.AtEndOfStream())
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
|
||||
return Error(InvalidRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseModuleTriple(std::string &Triple) {
|
||||
std::error_code BitcodeReader::ParseModuleTriple(std::string &Triple) {
|
||||
if (Stream.EnterSubBlock(bitc::MODULE_BLOCK_ID))
|
||||
return Error(InvalidRecord);
|
||||
|
||||
@ -2090,7 +2089,7 @@ error_code BitcodeReader::ParseModuleTriple(std::string &Triple) {
|
||||
case BitstreamEntry::Error:
|
||||
return Error(MalformedBlock);
|
||||
case BitstreamEntry::EndBlock:
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
@ -2111,8 +2110,8 @@ error_code BitcodeReader::ParseModuleTriple(std::string &Triple) {
|
||||
}
|
||||
}
|
||||
|
||||
error_code BitcodeReader::ParseTriple(std::string &Triple) {
|
||||
if (error_code EC = InitStream())
|
||||
std::error_code BitcodeReader::ParseTriple(std::string &Triple) {
|
||||
if (std::error_code EC = InitStream())
|
||||
return EC;
|
||||
|
||||
// Sniff for the signature.
|
||||
@ -2133,7 +2132,7 @@ error_code BitcodeReader::ParseTriple(std::string &Triple) {
|
||||
case BitstreamEntry::Error:
|
||||
return Error(MalformedBlock);
|
||||
case BitstreamEntry::EndBlock:
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
|
||||
case BitstreamEntry::SubBlock:
|
||||
if (Entry.ID == bitc::MODULE_BLOCK_ID)
|
||||
@ -2152,7 +2151,7 @@ error_code BitcodeReader::ParseTriple(std::string &Triple) {
|
||||
}
|
||||
|
||||
/// ParseMetadataAttachment - Parse metadata attachments.
|
||||
error_code BitcodeReader::ParseMetadataAttachment() {
|
||||
std::error_code BitcodeReader::ParseMetadataAttachment() {
|
||||
if (Stream.EnterSubBlock(bitc::METADATA_ATTACHMENT_ID))
|
||||
return Error(InvalidRecord);
|
||||
|
||||
@ -2165,7 +2164,7 @@ error_code BitcodeReader::ParseMetadataAttachment() {
|
||||
case BitstreamEntry::Error:
|
||||
return Error(MalformedBlock);
|
||||
case BitstreamEntry::EndBlock:
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
@ -2199,7 +2198,7 @@ error_code BitcodeReader::ParseMetadataAttachment() {
|
||||
}
|
||||
|
||||
/// ParseFunctionBody - Lazily parse the specified function body block.
|
||||
error_code BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
if (Stream.EnterSubBlock(bitc::FUNCTION_BLOCK_ID))
|
||||
return Error(InvalidRecord);
|
||||
|
||||
@ -2235,20 +2234,20 @@ error_code BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
return Error(InvalidRecord);
|
||||
break;
|
||||
case bitc::CONSTANTS_BLOCK_ID:
|
||||
if (error_code EC = ParseConstants())
|
||||
if (std::error_code EC = ParseConstants())
|
||||
return EC;
|
||||
NextValueNo = ValueList.size();
|
||||
break;
|
||||
case bitc::VALUE_SYMTAB_BLOCK_ID:
|
||||
if (error_code EC = ParseValueSymbolTable())
|
||||
if (std::error_code EC = ParseValueSymbolTable())
|
||||
return EC;
|
||||
break;
|
||||
case bitc::METADATA_ATTACHMENT_ID:
|
||||
if (error_code EC = ParseMetadataAttachment())
|
||||
if (std::error_code EC = ParseMetadataAttachment())
|
||||
return EC;
|
||||
break;
|
||||
case bitc::METADATA_BLOCK_ID:
|
||||
if (error_code EC = ParseMetadata())
|
||||
if (std::error_code EC = ParseMetadata())
|
||||
return EC;
|
||||
break;
|
||||
}
|
||||
@ -3118,21 +3117,22 @@ OutOfRecordLoop:
|
||||
ValueList.shrinkTo(ModuleValueListSize);
|
||||
MDValueList.shrinkTo(ModuleMDValueListSize);
|
||||
std::vector<BasicBlock*>().swap(FunctionBBs);
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
/// Find the function body in the bitcode stream
|
||||
error_code BitcodeReader::FindFunctionInStream(Function *F,
|
||||
DenseMap<Function*, uint64_t>::iterator DeferredFunctionInfoIterator) {
|
||||
std::error_code BitcodeReader::FindFunctionInStream(
|
||||
Function *F,
|
||||
DenseMap<Function *, uint64_t>::iterator DeferredFunctionInfoIterator) {
|
||||
while (DeferredFunctionInfoIterator->second == 0) {
|
||||
if (Stream.AtEndOfStream())
|
||||
return Error(CouldNotFindFunctionInStream);
|
||||
// ParseModule will parse the next body in the stream and set its
|
||||
// position in the DeferredFunctionInfo map.
|
||||
if (error_code EC = ParseModule(true))
|
||||
if (std::error_code EC = ParseModule(true))
|
||||
return EC;
|
||||
}
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -3148,24 +3148,24 @@ bool BitcodeReader::isMaterializable(const GlobalValue *GV) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
error_code BitcodeReader::Materialize(GlobalValue *GV) {
|
||||
std::error_code BitcodeReader::Materialize(GlobalValue *GV) {
|
||||
Function *F = dyn_cast<Function>(GV);
|
||||
// If it's not a function or is already material, ignore the request.
|
||||
if (!F || !F->isMaterializable())
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
|
||||
DenseMap<Function*, uint64_t>::iterator DFII = DeferredFunctionInfo.find(F);
|
||||
assert(DFII != DeferredFunctionInfo.end() && "Deferred function not found!");
|
||||
// If its position is recorded as 0, its body is somewhere in the stream
|
||||
// but we haven't seen it yet.
|
||||
if (DFII->second == 0 && LazyStreamer)
|
||||
if (error_code EC = FindFunctionInStream(F, DFII))
|
||||
if (std::error_code EC = FindFunctionInStream(F, DFII))
|
||||
return EC;
|
||||
|
||||
// Move the bit stream to the saved position of the deferred function body.
|
||||
Stream.JumpToBit(DFII->second);
|
||||
|
||||
if (error_code EC = ParseFunctionBody(F))
|
||||
if (std::error_code EC = ParseFunctionBody(F))
|
||||
return EC;
|
||||
|
||||
// Upgrade any old intrinsic calls in the function.
|
||||
@ -3180,7 +3180,7 @@ error_code BitcodeReader::Materialize(GlobalValue *GV) {
|
||||
}
|
||||
}
|
||||
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
bool BitcodeReader::isDematerializable(const GlobalValue *GV) const {
|
||||
@ -3202,8 +3202,7 @@ void BitcodeReader::Dematerialize(GlobalValue *GV) {
|
||||
F->deleteBody();
|
||||
}
|
||||
|
||||
|
||||
error_code BitcodeReader::MaterializeModule(Module *M) {
|
||||
std::error_code BitcodeReader::MaterializeModule(Module *M) {
|
||||
assert(M == TheModule &&
|
||||
"Can only Materialize the Module this BitcodeReader is attached to.");
|
||||
// Iterate over the module, deserializing any functions that are still on
|
||||
@ -3211,7 +3210,7 @@ error_code BitcodeReader::MaterializeModule(Module *M) {
|
||||
for (Module::iterator F = TheModule->begin(), E = TheModule->end();
|
||||
F != E; ++F) {
|
||||
if (F->isMaterializable()) {
|
||||
if (error_code EC = Materialize(F))
|
||||
if (std::error_code EC = Materialize(F))
|
||||
return EC;
|
||||
}
|
||||
}
|
||||
@ -3244,16 +3243,16 @@ error_code BitcodeReader::MaterializeModule(Module *M) {
|
||||
UpgradeInstWithTBAATag(InstsWithTBAATag[I]);
|
||||
|
||||
UpgradeDebugInfo(*M);
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
error_code BitcodeReader::InitStream() {
|
||||
std::error_code BitcodeReader::InitStream() {
|
||||
if (LazyStreamer)
|
||||
return InitLazyStream();
|
||||
return InitStreamFromBuffer();
|
||||
}
|
||||
|
||||
error_code BitcodeReader::InitStreamFromBuffer() {
|
||||
std::error_code BitcodeReader::InitStreamFromBuffer() {
|
||||
const unsigned char *BufPtr = (const unsigned char*)Buffer->getBufferStart();
|
||||
const unsigned char *BufEnd = BufPtr+Buffer->getBufferSize();
|
||||
|
||||
@ -3273,10 +3272,10 @@ error_code BitcodeReader::InitStreamFromBuffer() {
|
||||
StreamFile.reset(new BitstreamReader(BufPtr, BufEnd));
|
||||
Stream.init(*StreamFile);
|
||||
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
error_code BitcodeReader::InitLazyStream() {
|
||||
std::error_code BitcodeReader::InitLazyStream() {
|
||||
// Check and strip off the bitcode wrapper; BitstreamReader expects never to
|
||||
// see it.
|
||||
StreamingMemoryObject *Bytes = new StreamingMemoryObject(LazyStreamer);
|
||||
@ -3297,7 +3296,7 @@ error_code BitcodeReader::InitLazyStream() {
|
||||
Bytes->dropLeadingBytes(bitcodeStart - buf);
|
||||
Bytes->setKnownObjectSize(bitcodeEnd - bitcodeStart);
|
||||
}
|
||||
return error_code();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -3368,7 +3367,7 @@ ErrorOr<Module *> llvm::getLazyBitcodeModule(MemoryBuffer *Buffer,
|
||||
Module *M = new Module(Buffer->getBufferIdentifier(), Context);
|
||||
BitcodeReader *R = new BitcodeReader(Buffer, Context);
|
||||
M->setMaterializer(R);
|
||||
if (error_code EC = R->ParseBitcodeInto(M)) {
|
||||
if (std::error_code EC = R->ParseBitcodeInto(M)) {
|
||||
delete M; // Also deletes R.
|
||||
return EC;
|
||||
}
|
||||
@ -3388,7 +3387,7 @@ Module *llvm::getStreamedBitcodeModule(const std::string &name,
|
||||
Module *M = new Module(name, Context);
|
||||
BitcodeReader *R = new BitcodeReader(streamer, Context);
|
||||
M->setMaterializer(R);
|
||||
if (error_code EC = R->ParseBitcodeInto(M)) {
|
||||
if (std::error_code EC = R->ParseBitcodeInto(M)) {
|
||||
if (ErrMsg)
|
||||
*ErrMsg = EC.message();
|
||||
delete M; // Also deletes R.
|
||||
@ -3410,7 +3409,7 @@ ErrorOr<Module *> llvm::parseBitcodeFile(MemoryBuffer *Buffer,
|
||||
static_cast<BitcodeReader*>(M->getMaterializer())->setBufferOwned(false);
|
||||
|
||||
// Read in the entire module, and destroy the BitcodeReader.
|
||||
if (error_code EC = M->materializeAllPermanently()) {
|
||||
if (std::error_code EC = M->materializeAllPermanently()) {
|
||||
delete M;
|
||||
return EC;
|
||||
}
|
||||
@ -3429,7 +3428,7 @@ std::string llvm::getBitcodeTargetTriple(MemoryBuffer *Buffer,
|
||||
R->setBufferOwned(false);
|
||||
|
||||
std::string Triple("");
|
||||
if (error_code EC = R->ParseTriple(Triple))
|
||||
if (std::error_code EC = R->ParseTriple(Triple))
|
||||
if (ErrMsg)
|
||||
*ErrMsg = EC.message();
|
||||
|
||||
|
Reference in New Issue
Block a user