OLD | NEW |
1 //===-- NaClObjDump.cpp - Dump PNaCl bitcode contents ---------------------===// | 1 //===-- NaClObjDump.cpp - Dump PNaCl bitcode contents ---------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 | 9 |
10 #include "llvm/ADT/STLExtras.h" | 10 #include "llvm/ADT/STLExtras.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 OpenParen(this, "("), | 264 OpenParen(this, "("), |
265 CloseParen(this, ")"), | 265 CloseParen(this, ")"), |
266 OpenAngle(this, "<"), | 266 OpenAngle(this, "<"), |
267 CloseAngle(this, ">"), | 267 CloseAngle(this, ">"), |
268 OpenCurly(this, "{"), | 268 OpenCurly(this, "{"), |
269 CloseCurly(this, "}"), | 269 CloseCurly(this, "}"), |
270 OpenSquare(this, "["), | 270 OpenSquare(this, "["), |
271 CloseSquare(this, "]"), | 271 CloseSquare(this, "]"), |
272 Endline(this), | 272 Endline(this), |
273 StartCluster(this), | 273 StartCluster(this), |
274 FinishCluster(this), | 274 FinishCluster(this) |
275 ObjDump(ObjDump) | |
276 { | 275 { |
277 ContinuationIndent = GetIndent(2); | 276 ContinuationIndent = GetIndent(2); |
278 } | 277 } |
279 | 278 |
280 ~AssemblyTextFormatter() override {} | 279 ~AssemblyTextFormatter() override {} |
281 | 280 |
282 naclbitc::TokenTextDirective Comma; | 281 naclbitc::TokenTextDirective Comma; |
283 naclbitc::TokenTextDirective Semicolon; | 282 naclbitc::TokenTextDirective Semicolon; |
284 naclbitc::TokenTextDirective Colon; | 283 naclbitc::TokenTextDirective Colon; |
285 naclbitc::SpaceTextDirective Space; | 284 naclbitc::SpaceTextDirective Space; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 /// or global. | 330 /// or global. |
332 AbbrevIndexDirective &TokenizeAbbrevIndex(NaClBitcodeRecord &Record, | 331 AbbrevIndexDirective &TokenizeAbbrevIndex(NaClBitcodeRecord &Record, |
333 unsigned NumGlobalAbbreviations) { | 332 unsigned NumGlobalAbbreviations) { |
334 AbbrevIndexDirective *Dir = AbbrevIndexDirMemoryPool.Allocate(this); | 333 AbbrevIndexDirective *Dir = AbbrevIndexDirMemoryPool.Allocate(this); |
335 Dir->Record = &Record; | 334 Dir->Record = &Record; |
336 Dir->NumGlobalAbbreviations = NumGlobalAbbreviations; | 335 Dir->NumGlobalAbbreviations = NumGlobalAbbreviations; |
337 return *Dir; | 336 return *Dir; |
338 } | 337 } |
339 | 338 |
340 private: | 339 private: |
341 // The ObjDumpStream associated with this text formatter. | |
342 naclbitc::ObjDumpStream &ObjDump; | |
343 | |
344 // Converts the given type to tokens, based on the values passed in | 340 // Converts the given type to tokens, based on the values passed in |
345 // by TokenizeType, TokenizeFunctionType, or TokenizeFunctionSignature. | 341 // by TokenizeType, TokenizeFunctionType, or TokenizeFunctionSignature. |
346 void TokenizeTypeInternal(Type *Typ, BitcodeId* FcnName, bool AddParams); | 342 void TokenizeTypeInternal(Type *Typ, BitcodeId* FcnName, bool AddParams); |
347 | 343 |
348 // The free list of type directives. | 344 // The free list of type directives. |
349 naclbitc::DirectiveMemoryPool<TypeDirective> TypeDirMemoryPool; | 345 naclbitc::DirectiveMemoryPool<TypeDirective> TypeDirMemoryPool; |
350 | 346 |
351 // Allocates an instance of TypeDirective with the following fields. | 347 // Allocates an instance of TypeDirective with the following fields. |
352 TypeDirective &AllocateTypeDirective(Type *Typ, BitcodeId *FcnId, | 348 TypeDirective &AllocateTypeDirective(Type *Typ, BitcodeId *FcnId, |
353 bool AddParams); | 349 bool AddParams); |
(...skipping 3219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3573 ObjDump.Error() << "Expected 1 top level block in bitcode: Found:" | 3569 ObjDump.Error() << "Expected 1 top level block in bitcode: Found:" |
3574 << NumBlocksRead << "\n"; | 3570 << NumBlocksRead << "\n"; |
3575 ErrorsFound = true; | 3571 ErrorsFound = true; |
3576 } | 3572 } |
3577 | 3573 |
3578 ObjDump.Flush(); | 3574 ObjDump.Flush(); |
3579 return ErrorsFound || Parser.GetNumErrors() > 0; | 3575 return ErrorsFound || Parser.GetNumErrors() > 0; |
3580 } | 3576 } |
3581 | 3577 |
3582 } | 3578 } |
OLD | NEW |