Skip to content

Commit 510dcce

Browse files
committed
Use macro for variable name.
1 parent d64271d commit 510dcce

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

torch_xla/csrc/status.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
namespace torch_xla {
77

8+
#define _XLA_STATUS_VAR _statusor
9+
810
#define _XLA_RETURN_IF_ERROR_AND_THEN(REXPR, ...) \
911
{ \
10-
auto& _statusor = (REXPR); \
11-
if (!_statusor.ok()) { \
12-
return _statusor.status(); \
12+
auto& _XLA_STATUS_VAR = (REXPR); \
13+
if (!_XLA_STATUS_VAR.ok()) { \
14+
return _XLA_STATUS_VAR.status(); \
1315
} \
1416
__VA_ARGS__ \
1517
}
@@ -20,7 +22,8 @@ namespace torch_xla {
2022
// Propagates `REXPR`, in case it's a non-ok status. Otherwise, assign
2123
// its result to `LHS`.
2224
#define XLA_ASSIGN_OR_RETURN(LHS, REXPR) \
23-
_XLA_RETURN_IF_ERROR_AND_THEN(REXPR, { LHS = std::move(_status.value()); })
25+
_XLA_RETURN_IF_ERROR_AND_THEN(REXPR, \
26+
{ LHS = std::move(_XLA_STATUS_VAR.value()); })
2427

2528
// Consumes the `status` and maybe throws an exception if `status` has
2629
// a non-ok code.

0 commit comments

Comments
 (0)