@@ -161,7 +161,7 @@ std::string Operator::getQualCppClassName() const {
161161StringRef Operator::getCppNamespace () const { return cppNamespace; }
162162
163163int Operator::getNumResults () const {
164- DagInit *results = def.getValueAsDag (" results" );
164+ const DagInit *results = def.getValueAsDag (" results" );
165165 return results->getNumArgs ();
166166}
167167
@@ -198,12 +198,12 @@ auto Operator::getResults() const -> const_value_range {
198198}
199199
200200TypeConstraint Operator::getResultTypeConstraint (int index) const {
201- DagInit *results = def.getValueAsDag (" results" );
201+ const DagInit *results = def.getValueAsDag (" results" );
202202 return TypeConstraint (cast<DefInit>(results->getArg (index)));
203203}
204204
205205StringRef Operator::getResultName (int index) const {
206- DagInit *results = def.getValueAsDag (" results" );
206+ const DagInit *results = def.getValueAsDag (" results" );
207207 return results->getArgNameStr (index);
208208}
209209
@@ -241,7 +241,7 @@ Operator::arg_range Operator::getArgs() const {
241241}
242242
243243StringRef Operator::getArgName (int index) const {
244- DagInit *argumentValues = def.getValueAsDag (" arguments" );
244+ const DagInit *argumentValues = def.getValueAsDag (" arguments" );
245245 return argumentValues->getArgNameStr (index);
246246}
247247
@@ -557,7 +557,7 @@ void Operator::populateOpStructure() {
557557 auto *opVarClass = recordKeeper.getClass (" OpVariable" );
558558 numNativeAttributes = 0 ;
559559
560- DagInit *argumentValues = def.getValueAsDag (" arguments" );
560+ const DagInit *argumentValues = def.getValueAsDag (" arguments" );
561561 unsigned numArgs = argumentValues->getNumArgs ();
562562
563563 // Mapping from name of to argument or result index. Arguments are indexed
@@ -721,8 +721,8 @@ void Operator::populateOpStructure() {
721721 " to precede it in traits list" );
722722 };
723723
724- std::function<void (llvm::ListInit *)> insert;
725- insert = [&](llvm::ListInit *traitList) {
724+ std::function<void (const llvm::ListInit *)> insert;
725+ insert = [&](const llvm::ListInit *traitList) {
726726 for (auto *traitInit : *traitList) {
727727 auto *def = cast<DefInit>(traitInit)->getDef ();
728728 if (def->isSubClassOf (" TraitList" )) {
@@ -780,7 +780,7 @@ void Operator::populateOpStructure() {
780780 auto *builderList =
781781 dyn_cast_or_null<llvm::ListInit>(def.getValueInit (" builders" ));
782782 if (builderList && !builderList->empty ()) {
783- for (llvm::Init *init : builderList->getValues ())
783+ for (const llvm::Init *init : builderList->getValues ())
784784 builders.emplace_back (cast<llvm::DefInit>(init)->getDef (), def.getLoc ());
785785 } else if (skipDefaultBuilders ()) {
786786 PrintFatalError (
@@ -818,7 +818,8 @@ bool Operator::hasAssemblyFormat() const {
818818}
819819
820820StringRef Operator::getAssemblyFormat () const {
821- return TypeSwitch<llvm::Init *, StringRef>(def.getValueInit (" assemblyFormat" ))
821+ return TypeSwitch<const llvm::Init *, StringRef>(
822+ def.getValueInit (" assemblyFormat" ))
822823 .Case <llvm::StringInit>([&](auto *init) { return init->getValue (); });
823824}
824825
@@ -832,7 +833,7 @@ void Operator::print(llvm::raw_ostream &os) const {
832833 }
833834}
834835
835- auto Operator::VariableDecoratorIterator::unwrap (llvm::Init *init)
836+ auto Operator::VariableDecoratorIterator::unwrap (const llvm::Init *init)
836837 -> VariableDecorator {
837838 return VariableDecorator (cast<llvm::DefInit>(init)->getDef ());
838839}
0 commit comments