diff options
author | Karl Schimpf <kschimpf@google.com> | 2013-07-22 13:36:16 -0700 |
---|---|---|
committer | Karl Schimpf <kschimpf@google.com> | 2013-07-22 13:36:16 -0700 |
commit | 0b41f88a8de25db50e1a57645a6e132954a6dcd2 (patch) | |
tree | 059d73d19b2f788ce145d90015dd53b091095f28 /include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h | |
parent | 208b40ed21d78767d9d1c3c855cbd2e3a3c02451 (diff) |
Enable ability to have multiple PNaCl wire format versions.
Modifies PNaCl bitcode reader/writer to accept PNaClVersion=1 as supported,
and all other versions are unsupported and unreadable. The PNaCl bitcode
reader/writer will generate appropriate messages (including what version
is unsupported if applicable).
Also allows command-line option --pnacl-version for setting the PNaClVersion
in the PNaCl bitcode writer.
Also fixes some problems on PNaCl bitcode headers, using common support to
determine when the read/written PNaCl bitcode file is valid.
BUG=None
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/19400002
Diffstat (limited to 'include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h')
-rw-r--r-- | include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h b/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h index 8febf95564..4f5f83a17a 100644 --- a/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h +++ b/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h @@ -151,6 +151,12 @@ public: /// is readable and supported. void InstallFields(); + /// \brief Adds a field to the list of fields in a header. Takes ownership + /// of fields added. + void push_back(NaClBitcodeHeaderField *Field) { + Fields.push_back(Field); + } + /// \brief Read the PNaCl bitcode header, The format of the header is: /// /// 1) 'PEXE' - The four character sequence defining the magic number. @@ -172,9 +178,9 @@ public: // \brief Returns the number of bytes read to consume the header. size_t getHeaderSize() { return HeaderSize; } - /// \brief Returns C string describing why the header describes - /// an unsupported PNaCl Bitcode file. Returns 0 if supported. - const std::string Unsupported() const { return UnsupportedMessage; } + /// \brief Returns string describing why the header describes + /// an unsupported PNaCl Bitcode file. + const std::string &Unsupported() const { return UnsupportedMessage; } /// \brief Returns true if supported. That is, it can be run in the /// browser. |