OLD | NEW |
1 //===- NaClBitcodeParser.h -----------------------------------*- C++ -*-===// | 1 //===- NaClBitcodeParser.h -----------------------------------*- C++ -*-===// |
2 // Low-level bitcode driver to parse PNaCl bitcode files. | 2 // Low-level bitcode driver to parse PNaCl bitcode files. |
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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 | 590 |
591 // The current record (within the block) being processed. | 591 // The current record (within the block) being processed. |
592 NaClBitcodeRecord Record; | 592 NaClBitcodeRecord Record; |
593 | 593 |
594 // The listener (if any) to use. | 594 // The listener (if any) to use. |
595 NaClBitcodeParserListener *Listener; | 595 NaClBitcodeParserListener *Listener; |
596 | 596 |
597 // The error stream to use if non-null (uses errs() if null). | 597 // The error stream to use if non-null (uses errs() if null). |
598 raw_ostream *ErrStream; | 598 raw_ostream *ErrStream; |
599 | 599 |
600 // Creates a block parser to parse the block associated with the | 600 // Creates a block parser to parse the block associated with the bitcode entry |
601 // bitcode entry that defines the beginning of a block. This | 601 // that defines the beginning of a block. This instance actually parses the |
602 // instance actually parses the corresponding block. | 602 // corresponding block. Inherits the bitstream cursor from the |
| 603 // EnclosingParser. |
603 NaClBitcodeParser(unsigned BlockID, NaClBitcodeParser *EnclosingParser) | 604 NaClBitcodeParser(unsigned BlockID, NaClBitcodeParser *EnclosingParser) |
604 : EnclosingParser(EnclosingParser), | 605 : EnclosingParser(EnclosingParser), |
605 Block(BlockID, EnclosingParser->Record), | 606 Block(BlockID, EnclosingParser->Record), |
606 Record(Block), | 607 Record(Block), |
607 Listener(EnclosingParser->Listener), | 608 Listener(EnclosingParser->Listener), |
608 ErrStream(EnclosingParser->ErrStream) | 609 ErrStream(EnclosingParser->ErrStream) |
609 {} | 610 {} |
610 | 611 |
| 612 // Same as above, but use the supplied bitstream cursor (instead of |
| 613 // inheriting from the enclosing parser). This constructor allows |
| 614 // parallel parsing of subblocks, by allowing the caller to generate |
| 615 // a different Cursor for each block to be parsed in parallel. |
| 616 NaClBitcodeParser(unsigned BlockID, NaClBitcodeParser *EnclosingParser, |
| 617 NaClBitstreamCursor &Cursor) |
| 618 : EnclosingParser(EnclosingParser), |
| 619 Block(BlockID, Cursor), |
| 620 Record(Block), |
| 621 Listener(EnclosingParser->Listener), |
| 622 ErrStream(EnclosingParser->ErrStream) |
| 623 {} |
| 624 |
611 /// Defines the listener for this block, and all enclosing blocks, | 625 /// Defines the listener for this block, and all enclosing blocks, |
612 /// to be the given listener. Should be set in the constructor. | 626 /// to be the given listener. Should be set in the constructor. |
613 void SetListener(NaClBitcodeParserListener* UseListener) { | 627 void SetListener(NaClBitcodeParserListener* UseListener) { |
614 Listener = UseListener; | 628 Listener = UseListener; |
615 } | 629 } |
616 | 630 |
617 private: | 631 private: |
618 // Special constant identifying the top-level instance. | 632 // Special constant identifying the top-level instance. |
619 static const unsigned ILLEGAL_BLOCK_ID = UINT_MAX; | 633 static const unsigned ILLEGAL_BLOCK_ID = UINT_MAX; |
620 | 634 |
(...skipping 19 matching lines...) Expand all Loading... |
640 bool ParseBlockInternal(); | 654 bool ParseBlockInternal(); |
641 | 655 |
642 void operator=(const NaClBitcodeParser &Parser) = delete; | 656 void operator=(const NaClBitcodeParser &Parser) = delete; |
643 NaClBitcodeParser(const NaClBitcodeParser &Parser) = delete; | 657 NaClBitcodeParser(const NaClBitcodeParser &Parser) = delete; |
644 | 658 |
645 }; | 659 }; |
646 | 660 |
647 } // namespace llvm | 661 } // namespace llvm |
648 | 662 |
649 #endif | 663 #endif |
OLD | NEW |