Chromium Code Reviews| 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 given bitstrem cursor (instead of inheriting | |
|
Jim Stichnoth
2016/03/23 21:20:29
bitstream
Jim Stichnoth
2016/03/23 21:20:29
maybe s/given/supplied/ ?
Karl
2016/03/24 19:29:09
Done.
| |
| 613 // from the enclosing parser). This constructor allows parallel parsing of | |
| 614 // subblocks, by allowing the caller to generate a different Cursor for each | |
| 615 // block to be parsed in parallel. | |
| 616 NaClBitcodeParser(unsigned BlockID, NaClBitcodeParser *EnclosingParser, | |
| 617 NaClBitstreamCursor &Cursor) | |
|
Jim Stichnoth
2016/03/23 21:20:29
I'm not familiar with this set of data structures,
John
2016/03/24 13:08:16
It is the right thing as NaClBitcodeData holds a n
Jim Stichnoth
2016/03/24 13:09:19
OK - otherwise LGTM.
Karl
2016/03/24 19:29:09
Acknowledged.
| |
| 618 : EnclosingParser(EnclosingParser), | |
| 619 Block(BlockID, Cursor), | |
| 620 Record(Block), | |
| 621 Listener(0), | |
|
Jim Stichnoth
2016/03/23 21:20:29
Listener(nullptr)
Karl
2016/03/24 19:29:09
Actually, it should have been:
Listener(Enclos
| |
| 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 |