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

Unified Diff: lib/Bitcode/NaCl/TestUtils/NaClBitcodeMungeUtils.cpp

Issue 1139673004: Harden writer of munged bitcode for fuzzing (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix nits. 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: lib/Bitcode/NaCl/TestUtils/NaClBitcodeMungeUtils.cpp
diff --git a/lib/Bitcode/NaCl/TestUtils/NaClBitcodeMungeUtils.cpp b/lib/Bitcode/NaCl/TestUtils/NaClBitcodeMungeUtils.cpp
index be28d06fc96c1dea29373fa16ca91a4fab8d30d8..36d532b5787b3bfaea0fbf62b16dfe985183eb21 100644
--- a/lib/Bitcode/NaCl/TestUtils/NaClBitcodeMungeUtils.cpp
+++ b/lib/Bitcode/NaCl/TestUtils/NaClBitcodeMungeUtils.cpp
@@ -87,7 +87,7 @@ void readNaClBitcodeRecordList(NaClBitcodeRecordList &RecordList,
} // end of namespace llvm
void NaClBitcodeAbbrevRecord::print(raw_ostream &Out) const {
- NaClBitcodeRecordData::Print(Out << format("%8u", Abbrev) << ": ");
+ NaClBitcodeRecordData::Print(Out << Abbrev << ": ");
}
void NaClBitcodeAbbrevRecord::read(const uint64_t Vals[], size_t ValsSize,
@@ -119,6 +119,13 @@ void NaClMungedBitcode::print(raw_ostream &Out) const {
for (size_t i = 0; i < Indent; ++i) {
Out << " ";
}
+ // Blank fill to make abbreviation indices right align, and then
+ // print record.
+ uint32_t Cutoff = 9999999;
+ while (Record.Abbrev <= Cutoff && Cutoff) {
+ Out << " ";
+ Cutoff /= 10;
+ }
Out << Record << "\n";
if (Record.Code == naclbitc::BLK_CODE_ENTER)
++Indent;

Powered by Google App Engine
This is Rietveld 408576698