llvm.org GIT mirror llvm / 9326308
Rename Error -> ReportError. Error conflicts with the llvm::Error datatype, creating ambiguities. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283128 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 3 years ago
1 changed file(s) with 15 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
411411
412412
413413
414 /// Error - All bitcode analysis errors go through this function, making this a
414 /// ReportError - All bitcode analysis errors go through this function, making this a
415415 /// good place to breakpoint if debugging.
416 static bool Error(const Twine &Err) {
416 static bool ReportError(const Twine &Err) {
417417 errs() << Err << "\n";
418418 return true;
419419 }
442442 StringRef Strings = Blob.drop_front(StringsOffset);
443443 do {
444444 if (R.AtEndOfStream())
445 return Error("bad length");
445 return ReportError("bad length");
446446
447447 unsigned Size = R.ReadVBR(6);
448448 if (Strings.size() < Size)
449 return Error("truncated chars");
449 return ReportError("truncated chars");
450450
451451 outs() << Indent << " '";
452452 outs().write_escaped(Strings.slice(0, Size), /*hex=*/true);
485485 if (BlockID == bitc::BLOCKINFO_BLOCK_ID) {
486486 if (Dump) outs() << Indent << "\n";
487487 if (BitstreamCursor(Stream).ReadBlockInfoBlock())
488 return Error("Malformed BlockInfoBlock");
488 return ReportError("Malformed BlockInfoBlock");
489489 // It's not really interesting to dump the contents of the blockinfo block.
490490 DumpRecords = false;
491491 }
492492
493493 unsigned NumWords = 0;
494494 if (Stream.EnterSubBlock(BlockID, &NumWords))
495 return Error("Malformed block record");
495 return ReportError("Malformed block record");
496496
497497 // Keep it for later, when we see a MODULE_HASH record
498498 uint64_t BlockEntryPos = Stream.getCurrentByteNo();
518518 // Read all the records for this block.
519519 while (1) {
520520 if (Stream.AtEndOfStream())
521 return Error("Premature end of bitstream");
521 return ReportError("Premature end of bitstream");
522522
523523 uint64_t RecordStartBit = Stream.GetCurrentBitNo();
524524
527527
528528 switch (Entry.Kind) {
529529 case BitstreamEntry::Error:
530 return Error("malformed bitcode file");
530 return ReportError("malformed bitcode file");
531531 case BitstreamEntry::EndBlock: {
532532 uint64_t BlockBitEnd = Stream.GetCurrentBitNo();
533533 BlockStats.NumBits += BlockBitEnd-BlockBitStart;
700700 ErrorOr> MemBufOrErr =
701701 MemoryBuffer::getFileOrSTDIN(Path);
702702 if (std::error_code EC = MemBufOrErr.getError())
703 return Error(Twine("Error reading '") + Path + "': " + EC.message());
703 return ReportError(Twine("ReportError reading '") + Path + "': " + EC.message());
704704 MemBuf = std::move(MemBufOrErr.get());
705705
706706 if (MemBuf->getBufferSize() & 3)
707 return Error("Bitcode stream should be a multiple of 4 bytes in length");
707 return ReportError("Bitcode stream should be a multiple of 4 bytes in length");
708708
709709 const unsigned char *BufPtr = (const unsigned char *)MemBuf->getBufferStart();
710710 const unsigned char *EndBufPtr = BufPtr + MemBuf->getBufferSize();
713713 // The magic number is 0x0B17C0DE stored in little endian.
714714 if (isBitcodeWrapper(BufPtr, EndBufPtr)) {
715715 if (MemBuf->getBufferSize() < BWH_HeaderSize)
716 return Error("Invalid bitcode wrapper header");
716 return ReportError("Invalid bitcode wrapper header");
717717
718718 if (Dump) {
719719 unsigned Magic = support::endian::read32le(&BufPtr[BWH_MagicField]);
731731 }
732732
733733 if (SkipBitcodeWrapperHeader(BufPtr, EndBufPtr, true))
734 return Error("Invalid bitcode wrapper header");
734 return ReportError("Invalid bitcode wrapper header");
735735 }
736736
737737 StreamFile = BitstreamReader(BufPtr, EndBufPtr);
781781 while (!BlockInfoCursor.AtEndOfStream()) {
782782 unsigned Code = BlockInfoCursor.ReadCode();
783783 if (Code != bitc::ENTER_SUBBLOCK)
784 return Error("Invalid record at top-level in block info file");
784 return ReportError("Invalid record at top-level in block info file");
785785
786786 unsigned BlockID = BlockInfoCursor.ReadSubBlockID();
787787 if (BlockID == bitc::BLOCKINFO_BLOCK_ID) {
788788 if (BlockInfoCursor.ReadBlockInfoBlock())
789 return Error("Malformed BlockInfoBlock in block info file");
789 return ReportError("Malformed BlockInfoBlock in block info file");
790790 break;
791791 }
792792
802802 while (!Stream.AtEndOfStream()) {
803803 unsigned Code = Stream.ReadCode();
804804 if (Code != bitc::ENTER_SUBBLOCK)
805 return Error("Invalid record at top-level");
805 return ReportError("Invalid record at top-level");
806806
807807 unsigned BlockID = Stream.ReadSubBlockID();
808808