forked from OSchip/llvm-project
Code Custodian (trivial whitespace cleanup)
llvm-svn: 174550
This commit is contained in:
parent
f79f935f38
commit
97b7a1719e
|
@ -462,7 +462,7 @@ bool BitcodeReader::ParseAttributeBlock() {
|
|||
// Read all the records.
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::SubBlock: // Handled for us already.
|
||||
case BitstreamEntry::Error:
|
||||
|
@ -473,7 +473,7 @@ bool BitcodeReader::ParseAttributeBlock() {
|
|||
// The interesting case.
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Read a record.
|
||||
Record.clear();
|
||||
switch (Stream.readRecord(Entry.ID, Record)) {
|
||||
|
@ -517,7 +517,7 @@ bool BitcodeReader::ParseTypeTableBody() {
|
|||
// Read all the records for this type table.
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::SubBlock: // Handled for us already.
|
||||
case BitstreamEntry::Error:
|
||||
|
@ -734,7 +734,7 @@ bool BitcodeReader::ParseValueSymbolTable() {
|
|||
SmallString<128> ValueName;
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::SubBlock: // Handled for us already.
|
||||
case BitstreamEntry::Error:
|
||||
|
@ -789,7 +789,7 @@ bool BitcodeReader::ParseMetadata() {
|
|||
// Read all the records.
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::SubBlock: // Handled for us already.
|
||||
case BitstreamEntry::Error:
|
||||
|
@ -944,7 +944,7 @@ bool BitcodeReader::ParseConstants() {
|
|||
unsigned NextCstNo = ValueList.size();
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::SubBlock: // Handled for us already.
|
||||
case BitstreamEntry::Error:
|
||||
|
@ -952,7 +952,7 @@ bool BitcodeReader::ParseConstants() {
|
|||
case BitstreamEntry::EndBlock:
|
||||
if (NextCstNo != ValueList.size())
|
||||
return Error("Invalid constant reference!");
|
||||
|
||||
|
||||
// Once all the constants have been read, go through and resolve forward
|
||||
// references.
|
||||
ValueList.ResolveConstantForwardRefs();
|
||||
|
@ -1337,7 +1337,7 @@ bool BitcodeReader::ParseUseLists() {
|
|||
// Read all the records.
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::SubBlock: // Handled for us already.
|
||||
case BitstreamEntry::Error:
|
||||
|
@ -1425,14 +1425,14 @@ bool BitcodeReader::ParseModule(bool Resume) {
|
|||
// Read all the records for this module.
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advance();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::Error:
|
||||
Error("malformed module block");
|
||||
return true;
|
||||
case BitstreamEntry::EndBlock:
|
||||
return GlobalCleanup();
|
||||
|
||||
|
||||
case BitstreamEntry::SubBlock:
|
||||
switch (Entry.ID) {
|
||||
default: // Skip unknown content.
|
||||
|
@ -1473,7 +1473,7 @@ bool BitcodeReader::ParseModule(bool Resume) {
|
|||
return true;
|
||||
SeenFirstFunctionBody = true;
|
||||
}
|
||||
|
||||
|
||||
if (RememberAndSkipFunctionBody())
|
||||
return true;
|
||||
// For streaming bitcode, suspend parsing when we reach the function
|
||||
|
@ -1493,7 +1493,7 @@ bool BitcodeReader::ParseModule(bool Resume) {
|
|||
break;
|
||||
}
|
||||
continue;
|
||||
|
||||
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
|
@ -1714,17 +1714,17 @@ bool BitcodeReader::ParseBitcodeInto(Module *M) {
|
|||
while (1) {
|
||||
if (Stream.AtEndOfStream())
|
||||
return false;
|
||||
|
||||
|
||||
BitstreamEntry Entry =
|
||||
Stream.advance(BitstreamCursor::AF_DontAutoprocessAbbrevs);
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::Error:
|
||||
Error("malformed module file");
|
||||
return true;
|
||||
case BitstreamEntry::EndBlock:
|
||||
return false;
|
||||
|
||||
|
||||
case BitstreamEntry::SubBlock:
|
||||
switch (Entry.ID) {
|
||||
case bitc::BLOCKINFO_BLOCK_ID:
|
||||
|
@ -1748,7 +1748,7 @@ bool BitcodeReader::ParseBitcodeInto(Module *M) {
|
|||
continue;
|
||||
case BitstreamEntry::Record:
|
||||
// There should be no records in the top-level of blocks.
|
||||
|
||||
|
||||
// The ranlib in Xcode 4 will align archive members by appending newlines
|
||||
// to the end of them. If this file size is a multiple of 4 but not 8, we
|
||||
// have to read and ignore these final 4 bytes :-(
|
||||
|
@ -1756,7 +1756,7 @@ bool BitcodeReader::ParseBitcodeInto(Module *M) {
|
|||
Stream.Read(6) == 2 && Stream.Read(24) == 0xa0a0a &&
|
||||
Stream.AtEndOfStream())
|
||||
return false;
|
||||
|
||||
|
||||
return Error("Invalid record at top-level");
|
||||
}
|
||||
}
|
||||
|
@ -1771,7 +1771,7 @@ bool BitcodeReader::ParseModuleTriple(std::string &Triple) {
|
|||
// Read all the records for this module.
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::SubBlock: // Handled for us already.
|
||||
case BitstreamEntry::Error:
|
||||
|
@ -1814,25 +1814,25 @@ bool BitcodeReader::ParseTriple(std::string &Triple) {
|
|||
// need to understand them all.
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advance();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::Error:
|
||||
Error("malformed module file");
|
||||
return true;
|
||||
case BitstreamEntry::EndBlock:
|
||||
return false;
|
||||
|
||||
|
||||
case BitstreamEntry::SubBlock:
|
||||
if (Entry.ID == bitc::MODULE_BLOCK_ID)
|
||||
return ParseModuleTriple(Triple);
|
||||
|
||||
|
||||
// Ignore other sub-blocks.
|
||||
if (Stream.SkipBlock()) {
|
||||
Error("malformed block record in AST file");
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
|
||||
|
||||
case BitstreamEntry::Record:
|
||||
Stream.skipRecord(Entry.ID);
|
||||
continue;
|
||||
|
@ -1848,7 +1848,7 @@ bool BitcodeReader::ParseMetadataAttachment() {
|
|||
SmallVector<uint64_t, 64> Record;
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::SubBlock: // Handled for us already.
|
||||
case BitstreamEntry::Error:
|
||||
|
@ -1908,13 +1908,13 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
|||
SmallVector<uint64_t, 64> Record;
|
||||
while (1) {
|
||||
BitstreamEntry Entry = Stream.advance();
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case BitstreamEntry::Error:
|
||||
return Error("Bitcode error in function block");
|
||||
case BitstreamEntry::EndBlock:
|
||||
goto OutOfRecordLoop;
|
||||
|
||||
|
||||
case BitstreamEntry::SubBlock:
|
||||
switch (Entry.ID) {
|
||||
default: // Skip unknown content.
|
||||
|
@ -1936,12 +1936,12 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
|||
break;
|
||||
}
|
||||
continue;
|
||||
|
||||
|
||||
case BitstreamEntry::Record:
|
||||
// The interesting case.
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Read a record.
|
||||
Record.clear();
|
||||
Instruction *I = 0;
|
||||
|
@ -2723,7 +2723,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
|||
}
|
||||
|
||||
OutOfRecordLoop:
|
||||
|
||||
|
||||
// Check the function list for unresolved values.
|
||||
if (Argument *A = dyn_cast<Argument>(ValueList.back())) {
|
||||
if (A->getParent() == 0) {
|
||||
|
|
|
@ -17,19 +17,19 @@ using namespace llvm;
|
|||
|
||||
void BitstreamCursor::operator=(const BitstreamCursor &RHS) {
|
||||
freeState();
|
||||
|
||||
|
||||
BitStream = RHS.BitStream;
|
||||
NextChar = RHS.NextChar;
|
||||
CurWord = RHS.CurWord;
|
||||
BitsInCurWord = RHS.BitsInCurWord;
|
||||
CurCodeSize = RHS.CurCodeSize;
|
||||
|
||||
|
||||
// Copy abbreviations, and bump ref counts.
|
||||
CurAbbrevs = RHS.CurAbbrevs;
|
||||
for (unsigned i = 0, e = static_cast<unsigned>(CurAbbrevs.size());
|
||||
i != e; ++i)
|
||||
CurAbbrevs[i]->addRef();
|
||||
|
||||
|
||||
// Copy block scope and bump ref counts.
|
||||
BlockScope = RHS.BlockScope;
|
||||
for (unsigned S = 0, e = static_cast<unsigned>(BlockScope.size());
|
||||
|
@ -47,7 +47,7 @@ void BitstreamCursor::freeState() {
|
|||
i != e; ++i)
|
||||
CurAbbrevs[i]->dropRef();
|
||||
CurAbbrevs.clear();
|
||||
|
||||
|
||||
// Free all the Abbrevs in the block scope.
|
||||
for (unsigned S = 0, e = static_cast<unsigned>(BlockScope.size());
|
||||
S != e; ++S) {
|
||||
|
@ -65,7 +65,7 @@ bool BitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) {
|
|||
// Save the current block's state on BlockScope.
|
||||
BlockScope.push_back(Block(CurCodeSize));
|
||||
BlockScope.back().PrevAbbrevs.swap(CurAbbrevs);
|
||||
|
||||
|
||||
// Add the abbrevs specific to this block to the CurAbbrevs list.
|
||||
if (const BitstreamReader::BlockInfo *Info =
|
||||
BitStream->getBlockInfo(BlockID)) {
|
||||
|
@ -75,17 +75,17 @@ bool BitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) {
|
|||
CurAbbrevs.back()->addRef();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get the codesize of this block.
|
||||
CurCodeSize = ReadVBR(bitc::CodeLenWidth);
|
||||
SkipToFourByteBoundary();
|
||||
unsigned NumWords = Read(bitc::BlockSizeWidth);
|
||||
if (NumWordsP) *NumWordsP = NumWords;
|
||||
|
||||
|
||||
// Validate that this block is sane.
|
||||
if (CurCodeSize == 0 || AtEndOfStream())
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ void BitstreamCursor::readAbbreviatedLiteral(const BitCodeAbbrevOp &Op,
|
|||
void BitstreamCursor::readAbbreviatedField(const BitCodeAbbrevOp &Op,
|
||||
SmallVectorImpl<uint64_t> &Vals) {
|
||||
assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!");
|
||||
|
||||
|
||||
// Decode the value as we are commanded.
|
||||
switch (Op.getEncoding()) {
|
||||
case BitCodeAbbrevOp::Array:
|
||||
|
@ -119,7 +119,7 @@ void BitstreamCursor::readAbbreviatedField(const BitCodeAbbrevOp &Op,
|
|||
|
||||
void BitstreamCursor::skipAbbreviatedField(const BitCodeAbbrevOp &Op) {
|
||||
assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!");
|
||||
|
||||
|
||||
// Decode the value as we are commanded.
|
||||
switch (Op.getEncoding()) {
|
||||
case BitCodeAbbrevOp::Array:
|
||||
|
@ -152,47 +152,47 @@ void BitstreamCursor::skipRecord(unsigned AbbrevID) {
|
|||
}
|
||||
|
||||
const BitCodeAbbrev *Abbv = getAbbrev(AbbrevID);
|
||||
|
||||
|
||||
for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) {
|
||||
const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
|
||||
if (Op.isLiteral())
|
||||
continue;
|
||||
|
||||
|
||||
if (Op.getEncoding() != BitCodeAbbrevOp::Array &&
|
||||
Op.getEncoding() != BitCodeAbbrevOp::Blob) {
|
||||
skipAbbreviatedField(Op);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (Op.getEncoding() == BitCodeAbbrevOp::Array) {
|
||||
// Array case. Read the number of elements as a vbr6.
|
||||
unsigned NumElts = ReadVBR(6);
|
||||
|
||||
|
||||
// Get the element encoding.
|
||||
assert(i+2 == e && "array op not second to last?");
|
||||
const BitCodeAbbrevOp &EltEnc = Abbv->getOperandInfo(++i);
|
||||
|
||||
|
||||
// Read all the elements.
|
||||
for (; NumElts; --NumElts)
|
||||
skipAbbreviatedField(EltEnc);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
assert(Op.getEncoding() == BitCodeAbbrevOp::Blob);
|
||||
// Blob case. Read the number of bytes as a vbr6.
|
||||
unsigned NumElts = ReadVBR(6);
|
||||
SkipToFourByteBoundary(); // 32-bit alignment
|
||||
|
||||
|
||||
// Figure out where the end of this blob will be including tail padding.
|
||||
size_t NewEnd = GetCurrentBitNo()+((NumElts+3)&~3)*8;
|
||||
|
||||
|
||||
// If this would read off the end of the bitcode file, just set the
|
||||
// record to empty and return.
|
||||
if (!canSkipToPos(NewEnd/8)) {
|
||||
NextChar = BitStream->getBitcodeBytes().getExtent();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Skip over the blob.
|
||||
JumpToBit(NewEnd);
|
||||
}
|
||||
|
@ -208,45 +208,45 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
|
|||
Vals.push_back(ReadVBR64(6));
|
||||
return Code;
|
||||
}
|
||||
|
||||
|
||||
const BitCodeAbbrev *Abbv = getAbbrev(AbbrevID);
|
||||
|
||||
|
||||
for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) {
|
||||
const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
|
||||
if (Op.isLiteral()) {
|
||||
readAbbreviatedLiteral(Op, Vals);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (Op.getEncoding() != BitCodeAbbrevOp::Array &&
|
||||
Op.getEncoding() != BitCodeAbbrevOp::Blob) {
|
||||
readAbbreviatedField(Op, Vals);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (Op.getEncoding() == BitCodeAbbrevOp::Array) {
|
||||
// Array case. Read the number of elements as a vbr6.
|
||||
unsigned NumElts = ReadVBR(6);
|
||||
|
||||
|
||||
// Get the element encoding.
|
||||
assert(i+2 == e && "array op not second to last?");
|
||||
const BitCodeAbbrevOp &EltEnc = Abbv->getOperandInfo(++i);
|
||||
|
||||
|
||||
// Read all the elements.
|
||||
for (; NumElts; --NumElts)
|
||||
readAbbreviatedField(EltEnc, Vals);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
assert(Op.getEncoding() == BitCodeAbbrevOp::Blob);
|
||||
// Blob case. Read the number of bytes as a vbr6.
|
||||
unsigned NumElts = ReadVBR(6);
|
||||
SkipToFourByteBoundary(); // 32-bit alignment
|
||||
|
||||
|
||||
// Figure out where the end of this blob will be including tail padding.
|
||||
size_t CurBitPos = GetCurrentBitNo();
|
||||
size_t NewEnd = CurBitPos+((NumElts+3)&~3)*8;
|
||||
|
||||
|
||||
// If this would read off the end of the bitcode file, just set the
|
||||
// record to empty and return.
|
||||
if (!canSkipToPos(NewEnd/8)) {
|
||||
|
@ -254,11 +254,11 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
|
|||
NextChar = BitStream->getBitcodeBytes().getExtent();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Otherwise, inform the streamer that we need these bytes in memory.
|
||||
const char *Ptr = (const char*)
|
||||
BitStream->getBitcodeBytes().getPointer(CurBitPos/8, NumElts);
|
||||
|
||||
|
||||
// If we can return a reference to the data, do so to avoid copying it.
|
||||
if (Blob) {
|
||||
*Blob = StringRef(Ptr, NumElts);
|
||||
|
@ -270,7 +270,7 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
|
|||
// Skip over tail padding.
|
||||
JumpToBit(NewEnd);
|
||||
}
|
||||
|
||||
|
||||
unsigned Code = (unsigned)Vals[0];
|
||||
Vals.erase(Vals.begin());
|
||||
return Code;
|
||||
|
@ -286,7 +286,7 @@ void BitstreamCursor::ReadAbbrevRecord() {
|
|||
Abbv->Add(BitCodeAbbrevOp(ReadVBR64(8)));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
BitCodeAbbrevOp::Encoding E = (BitCodeAbbrevOp::Encoding)Read(3);
|
||||
if (BitCodeAbbrevOp::hasEncodingData(E))
|
||||
Abbv->Add(BitCodeAbbrevOp(E, ReadVBR64(5)));
|
||||
|
@ -300,16 +300,16 @@ bool BitstreamCursor::ReadBlockInfoBlock() {
|
|||
// If this is the second stream to get to the block info block, skip it.
|
||||
if (BitStream->hasBlockInfoRecords())
|
||||
return SkipBlock();
|
||||
|
||||
|
||||
if (EnterSubBlock(bitc::BLOCKINFO_BLOCK_ID)) return true;
|
||||
|
||||
|
||||
SmallVector<uint64_t, 64> Record;
|
||||
BitstreamReader::BlockInfo *CurBlockInfo = 0;
|
||||
|
||||
|
||||
// Read all the records for this module.
|
||||
while (1) {
|
||||
BitstreamEntry Entry = advanceSkippingSubblocks(AF_DontAutoprocessAbbrevs);
|
||||
|
||||
|
||||
switch (Entry.Kind) {
|
||||
case llvm::BitstreamEntry::SubBlock: // Handled for us already.
|
||||
case llvm::BitstreamEntry::Error:
|
||||
|
@ -325,7 +325,7 @@ bool BitstreamCursor::ReadBlockInfoBlock() {
|
|||
if (Entry.ID == bitc::DEFINE_ABBREV) {
|
||||
if (!CurBlockInfo) return true;
|
||||
ReadAbbrevRecord();
|
||||
|
||||
|
||||
// ReadAbbrevRecord installs the abbrev in CurAbbrevs. Move it to the
|
||||
// appropriate BlockInfo.
|
||||
BitCodeAbbrev *Abbv = CurAbbrevs.back();
|
||||
|
@ -333,7 +333,7 @@ bool BitstreamCursor::ReadBlockInfoBlock() {
|
|||
CurBlockInfo->Abbrevs.push_back(Abbv);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Read a record.
|
||||
Record.clear();
|
||||
switch (readRecord(Entry.ID, Record)) {
|
||||
|
@ -365,4 +365,3 @@ bool BitstreamCursor::ReadBlockInfoBlock() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue