LLVM  6.0.0svn
Public Types | Public Member Functions | List of all members
llvm::fuzzerop::SourcePred Class Reference

A matcher/generator for finding suitable values for the next source in an operation's partially completed argument list. More...

#include "llvm/FuzzMutate/OpDescriptor.h"

Public Types

using PredT = std::function< bool(ArrayRef< Value * > Cur, const Value *New)>
 Given a list of already selected operands, returns whether a given new operand is suitable for the next operand. More...
 
using MakeT = std::function< std::vector< Constant * >(ArrayRef< Value * > Cur, ArrayRef< Type * > BaseTypes)>
 Given a list of already selected operands and a set of valid base types for a fuzzer, generates a list of constants that could be used for the next operand. More...
 

Public Member Functions

 SourcePred (PredT Pred, MakeT Make)
 Create a fully general source predicate. More...
 
 SourcePred (PredT Pred, NoneType)
 
bool matches (ArrayRef< Value *> Cur, const Value *New)
 Returns true if New is compatible for the argument after Cur. More...
 
std::vector< Constant * > generate (ArrayRef< Value *> Cur, ArrayRef< Type *> BaseTypes)
 Generates a list of potential values for the argument after Cur. More...
 

Detailed Description

A matcher/generator for finding suitable values for the next source in an operation's partially completed argument list.

Given that we're building some operation X and may have already filled some subset of its operands, this predicate determines if some value New is suitable for the next operand or generates a set of values that are suitable.

Definition at line 43 of file OpDescriptor.h.

Member Typedef Documentation

◆ MakeT

using llvm::fuzzerop::SourcePred::MakeT = std::function<std::vector<Constant *>( ArrayRef<Value *> Cur, ArrayRef<Type *> BaseTypes)>

Given a list of already selected operands and a set of valid base types for a fuzzer, generates a list of constants that could be used for the next operand.

Definition at line 52 of file OpDescriptor.h.

◆ PredT

Given a list of already selected operands, returns whether a given new operand is suitable for the next operand.

Definition at line 47 of file OpDescriptor.h.

Constructor & Destructor Documentation

◆ SourcePred() [1/2]

llvm::fuzzerop::SourcePred::SourcePred ( PredT  Pred,
MakeT  Make 
)
inline

Create a fully general source predicate.

Definition at line 60 of file OpDescriptor.h.

◆ SourcePred() [2/2]

llvm::fuzzerop::SourcePred::SourcePred ( PredT  Pred,
NoneType   
)
inline

Member Function Documentation

◆ generate()

std::vector<Constant *> llvm::fuzzerop::SourcePred::generate ( ArrayRef< Value *>  Cur,
ArrayRef< Type *>  BaseTypes 
)
inline

Generates a list of potential values for the argument after Cur.

Definition at line 82 of file OpDescriptor.h.

Referenced by llvm::RandomIRBuilder::newSource().

◆ matches()

bool llvm::fuzzerop::SourcePred::matches ( ArrayRef< Value *>  Cur,
const Value New 
)
inline

Returns true if New is compatible for the argument after Cur.

Definition at line 77 of file OpDescriptor.h.

Referenced by llvm::RandomIRBuilder::findOrCreateSource(), llvm::RandomIRBuilder::findPointer(), and llvm::RandomIRBuilder::newSource().


The documentation for this class was generated from the following file: