forked from OSchip/llvm-project
Drop a RecordKeeper reference that wasn't necessary.
llvm-svn: 132636
This commit is contained in:
parent
5e300b82e2
commit
25b753bb3f
|
@ -140,10 +140,6 @@ struct DecimateOp : public SetIntBinOp {
|
|||
|
||||
// (sequence "Format", From, To) Generate a sequence of records by name.
|
||||
struct SequenceOp : public SetTheory::Operator {
|
||||
RecordKeeper &Records;
|
||||
|
||||
SequenceOp(RecordKeeper&R) : Records(R) {}
|
||||
|
||||
void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts) {
|
||||
if (Expr->arg_size() != 3)
|
||||
throw "Bad args to (sequence \"Format\", From, To): " +
|
||||
|
@ -164,6 +160,9 @@ struct SequenceOp : public SetTheory::Operator {
|
|||
else
|
||||
throw "From must be an integer: " + Expr->getAsString();
|
||||
|
||||
RecordKeeper &Records =
|
||||
dynamic_cast<DefInit&>(*Expr->getOperator()).getDef()->getRecords();
|
||||
|
||||
int Step = From <= To ? 1 : -1;
|
||||
for (To += Step; From != To; From += Step) {
|
||||
std::string Name;
|
||||
|
@ -193,7 +192,7 @@ struct FieldExpander : public SetTheory::Expander {
|
|||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
SetTheory::SetTheory(RecordKeeper *Records) {
|
||||
SetTheory::SetTheory() {
|
||||
addOperator("add", new AddOp);
|
||||
addOperator("sub", new SubOp);
|
||||
addOperator("and", new AndOp);
|
||||
|
@ -202,8 +201,7 @@ SetTheory::SetTheory(RecordKeeper *Records) {
|
|||
addOperator("rotl", new RotOp(false));
|
||||
addOperator("rotr", new RotOp(true));
|
||||
addOperator("decimate", new DecimateOp);
|
||||
if (Records)
|
||||
addOperator("sequence", new SequenceOp(*Records));
|
||||
addOperator("sequence", new SequenceOp);
|
||||
}
|
||||
|
||||
void SetTheory::addOperator(StringRef Name, Operator *Op) {
|
||||
|
|
|
@ -96,8 +96,7 @@ private:
|
|||
|
||||
public:
|
||||
/// Create a SetTheory instance with only the standard operators.
|
||||
/// A 'sequence' operator will only be added if a RecordKeeper is given.
|
||||
SetTheory(RecordKeeper *Records = 0);
|
||||
SetTheory();
|
||||
|
||||
/// addExpander - Add an expander for Records with the named super class.
|
||||
void addExpander(StringRef ClassName, Expander*);
|
||||
|
|
|
@ -380,7 +380,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
case PrintSets:
|
||||
{
|
||||
SetTheory Sets(&Records);
|
||||
SetTheory Sets;
|
||||
Sets.addFieldExpander("Set", "Elements");
|
||||
std::vector<Record*> Recs = Records.getAllDerivedDefinitions("Set");
|
||||
for (unsigned i = 0, e = Recs.size(); i != e; ++i) {
|
||||
|
|
Loading…
Reference in New Issue