[flang] Avoid copying scope. Improve readability.
authorSteve Scalpone <sscalpone@nvidia.com>
Mon, 15 Apr 2019 16:41:27 +0000 (09:41 -0700)
committerSteve Scalpone <sscalpone@nvidia.com>
Mon, 15 Apr 2019 17:59:12 +0000 (10:59 -0700)
Original-commit: flang-compiler/f18@5d2213cd7a68e9d125304e5d2e6e7e7fd8472b99
Tree-same-pre-rewrite: false

flang/lib/semantics/check-return.cc

index b280f13..19d4994 100644 (file)
@@ -38,8 +38,8 @@ void ReturnStmtChecker::Leave(const parser::ReturnStmt &returnStmt) {
   // subroutine subprogram.
   // C1575 The scalar-int-expr is allowed only in the inclusive scope of a
   // subroutine subprogram.
-  auto scope{context_.FindScope(*context_.location())};
-  auto subprogramScope{FindContainingSubprogram(scope)};
+  const auto &scope{context_.FindScope(*context_.location())};
+  const auto &subprogramScope{FindContainingSubprogram(scope)};
   if (subprogramScope == nullptr) {
     context_.Say(
         "RETURN must in the inclusive scope of a SUBPROGRAM"_err_en_US);