blob: e74ee1bc1ce8be5dd02ed4827f2ec79e98021150 [file] [log] [blame]
//===- BitcodeMunge.h - Subzero Bitcode Munger ------------------*- C++ -*-===//
// The LLVM Compiler Infrastructure
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Test harness for testing malformed bitcode files in Subzero. Uses NaCl's
// bitcode munger to do this.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include "llvm/Bitcode/NaCl/NaClBitcodeMunge.h"
#pragma clang diagnostic pop
#include "IceClFlags.h"
#include "IceGlobalContext.h"
namespace IceTest {
// Class to run tests on Subzero's bitcode parser. Runs a Subzero
// translation, using (possibly) edited bitcode record values. For
// more details on how to represent the input arrays, see
// NaClBitcodeMunge.h.
class SubzeroBitcodeMunger : public llvm::NaClBitcodeMunger {
SubzeroBitcodeMunger(const uint64_t Records[], size_t RecordSize,
uint64_t RecordTerminator)
: llvm::NaClBitcodeMunger(Records, RecordSize, RecordTerminator) {
/// Runs PNaClTranslator to parse and (optionally) translate bitcode records
/// (with defined record Munges), and puts output into DumpResults. Returns
/// true if parse is successful.
bool runTest(const uint64_t Munges[], size_t MungeSize,
bool DisableTranslation = false);
/// Same as above, but without any edits.
bool runTest(bool DisableTranslation = false) {
uint64_t NoMunges[] = {0};
return runTest(NoMunges, 0, DisableTranslation);
void resetMungeFlags();
} // end of namespace IceTest