Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Unified Diff: include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h

Issue 1113023005: Add abilities to generate bitcode buffers from munged bitcode. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Try to get better patch. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h b/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h
index 42f4bcf6683c9d9e0351f18c87cadbbb77c5898c..523d89aa9a482c39f8e73435b7652426df55ff70 100644
--- a/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h
+++ b/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h
@@ -13,7 +13,7 @@
// Generates a bitcode memory buffer from an array containing 1 or
// more PNaCl records. Used to test errors in PNaCl bitcode.
//
-// Bitcode records are modeleled using arrays using the format
+// Bitcode records are modeled using arrays using the format
// specified in NaClBitcodeMungeUtils.h.
//
// Note: Since the header record doesn't have any abbreviation indices
@@ -47,7 +47,6 @@
namespace llvm {
-class NaClBitstreamWriter;
class NaClBitCodeAbbrev;
/// Base class to run tests on munged bitcode files.
@@ -64,14 +63,16 @@ public:
static const EditAction Remove = NaClMungedBitcode::Remove;
static const EditAction Replace = NaClMungedBitcode::Replace;
+ /// The write flags to use when writing bitcode.
+ NaClMungedBitcode::WriteFlags WriteFlags;
jvoung (off chromium) 2015/05/06 22:08:09 nit: Seems a bit weird for this field to be public
Karl 2015/05/07 20:09:18 Moved to protected and added methods to set. Made
+
/// Creates a bitcode munger, based on the given array of values.
NaClBitcodeMunger(const uint64_t Records[], size_t RecordsSize,
uint64_t RecordTerminator)
: MungedBitcode(Records, RecordsSize, RecordTerminator),
- RecordTerminator(RecordTerminator), WriteBlockID(-1), SetBID(-1),
+ RecordTerminator(RecordTerminator),
DumpResults("Error: No previous dump results!\n"),
- DumpStream(nullptr), Writer(nullptr), FoundErrors(false),
- FatalBuffer(), FatalStream(FatalBuffer) {}
+ DumpStream(nullptr), FoundErrors(false) {}
/// Creates MungedInput and DumpStream for running tests, based on
/// given Munges.
@@ -104,26 +105,14 @@ protected:
NaClMungedBitcode MungedBitcode;
// The value used as record terminator.
uint64_t RecordTerminator;
- // The block ID associated with the block being written.
- int WriteBlockID;
- // The SetBID for the blockinfo block.
- int SetBID;
// The results buffer of the last dump.
std::string DumpResults;
// The memory buffer containing the munged input.
std::unique_ptr<MemoryBuffer> MungedInput;
// The stream containing errors and the objdump of the generated bitcode file.
raw_ostream *DumpStream;
- // The bitstream writer to use to generate the bitcode file.
- NaClBitstreamWriter *Writer;
// True if any errors were reported.
bool FoundErrors;
- // The buffer to hold the generated fatal message.
- std::string FatalBuffer;
- // The stream to write the fatal message to.
- raw_string_ostream FatalStream;
- // The stack of maximum abbreviation indices allowed by block enter record.
- SmallVector<uint64_t, 3> AbbrevIndexLimitStack;
// The buffer for the contents of the munged input.
SmallVector<char, 1024> MungedInputBuffer;
@@ -134,33 +123,11 @@ protected:
return *DumpStream << "Error: ";
}
- // Returns stream to print fatal error message to.
- // Note: Once the fatal error message has been dumped to the stream,
- // one must call ReportFatalError to display the error and terminate
- // execution.
- raw_ostream &Fatal() {
- return FatalStream << "Fatal: ";
- }
-
- // Displays the fatal error message and exits the program.
- void ReportFatalError() {
- report_fatal_error(FatalStream.str());
- }
-
// Returns the lines containing the given Substring, from the string
// getTestResults(). If MustBePrefix, then Substring must match at
// the beginning of the line.
std::string getLinesWithTextMatch(const std::string &Substring,
bool MustBePrefix = false) const;
-
- // Writes out munged bitcode records.
- void writeMungedBitcode(const NaClMungedBitcode &Bitcode, bool AddHeader);
-
- // Emits the given record to the bitcode file.
- void emitRecord(const NaClBitcodeAbbrevRecord &Record);
-
- // Converts the abbreviation record to the corresponding abbreviation.
- NaClBitCodeAbbrev *buildAbbrev(const NaClBitcodeAbbrevRecord &Record);
};
/// Class to run tests for function llvm::NaClObjDump.
« no previous file with comments | « no previous file | include/llvm/Bitcode/NaCl/NaClBitcodeMungeUtils.h » ('j') | include/llvm/Bitcode/NaCl/NaClBitcodeMungeUtils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698