@@ -854,8 +854,7 @@ struct to_ir {
854
854
855
855
if (self) {
856
856
AT_ASSERT (it != end);
857
- auto ident = (*it).ident ();
858
- const auto & name = ident.name ();
857
+ const auto & name = (*it).ident ().name ();
859
858
Value* new_input = block->addInput ()->setDebugName (name);
860
859
environment_stack->setSugaredVar (
861
860
(*it).ident ().range (),
@@ -873,8 +872,7 @@ struct to_ir {
873
872
bool shouldDeriveType = shouldDeriveSetStateType (def, schema);
874
873
size_t arg_annotation_idx = 0 ;
875
874
for (; it != end; ++it) {
876
- auto ident = (*it).ident ();
877
- auto & name = ident.name ();
875
+ auto & name = (*it).ident ().name ();
878
876
// Add the input to the graph
879
877
Value* new_input = block->addInput ();
880
878
if (meaningfulName (name)) {
@@ -1019,8 +1017,7 @@ struct to_ir {
1019
1017
" (see https://github.com/pytorch/pytorch/issues/31430)" );
1020
1018
}
1021
1019
const SugaredValuePtr sv = emitSugaredExpr (subscript.value (), 1 );
1022
- auto subscript_value = subscript.value ();
1023
- const SourceRange& val_range = subscript_value.range ();
1020
+ const SourceRange& val_range = subscript.value ().range ();
1024
1021
Value* idx = emitExpr (subscript_exprs[0 ]);
1025
1022
Value* val = sv->asValue (val_range, method);
1026
1023
@@ -1193,8 +1190,7 @@ struct to_ir {
1193
1190
return {};
1194
1191
}
1195
1192
// statement must be var {is, is not} None
1196
- auto var_lhs_name = Var (lhs).name ();
1197
- const std::string& name = var_lhs_name.name ();
1193
+ const std::string& name = Var (lhs).name ().name ();
1198
1194
// While it should in theory be possible to specialize
1199
1195
// the `x is None` to know x has type NoneType, we have previously
1200
1196
// not done this. Unfortunately, doing this will make the type None
@@ -2173,8 +2169,7 @@ struct to_ir {
2173
2169
ErrorReport (attrExpr)
2174
2170
<< " hasattr's second argument must be a string literal" );
2175
2171
}
2176
- auto literal = StringLiteral (attrExpr);
2177
- const std::string& name = literal.text ();
2172
+ const std::string& name = StringLiteral (attrExpr).text ();
2178
2173
const bool hasAttr = obj->hasAttr (objExpr.range (), method, name);
2179
2174
return CondValue (*graph, objExpr.range (), hasAttr, {});
2180
2175
}
@@ -3507,8 +3502,7 @@ struct to_ir {
3507
3502
ErrorReport (apply)
3508
3503
<< " getattr's second argument must be a string literal" );
3509
3504
}
3510
- auto literal = StringLiteral (selector);
3511
- const std::string& name = literal.text ();
3505
+ const std::string& name = StringLiteral (selector).text ();
3512
3506
3513
3507
if (apply.inputs ().size () == 2 ) {
3514
3508
return obj->attr (apply.range (), method, name);
@@ -5293,8 +5287,7 @@ struct to_ir {
5293
5287
const SugaredValuePtr sv = emitSugaredExpr (subscript.value (), 1 );
5294
5288
const List<Expr>& subscript_exprs = subscript.subscript_exprs ();
5295
5289
const SourceRange& range = subscript.range ();
5296
- const auto & val = subscript.value ();
5297
- const SourceRange& val_range = val.range ();
5290
+ const SourceRange& val_range = subscript.value ().range ();
5298
5291
if (subscript_exprs.size () != 1 ) {
5299
5292
return std::make_shared<SimpleValue>(emitMultidimSlicing (
5300
5293
range, sv->asValue (val_range, method), subscript_exprs));
0 commit comments