[flang] Remove unused variable in check-if-stmt.cc
authorSteve Scalpone <sscalpone@nvidia.com>
Tue, 2 Apr 2019 04:28:16 +0000 (21:28 -0700)
committerSteve Scalpone <sscalpone@nvidia.com>
Tue, 2 Apr 2019 04:28:16 +0000 (21:28 -0700)
Original-commit: flang-compiler/f18@520751311d5791341112ffa3a9b7e0fba90440b3
Reviewed-on: https://github.com/flang-compiler/f18/pull/375

flang/lib/semantics/check-if-stmt.cc

index a23e9ea..9720a85 100644 (file)
@@ -19,8 +19,6 @@
 
 namespace Fortran::semantics {
 
-template<class T> void suppress_unused_variable_warning(const T &) {}
-
 void IfStmtChecker::Leave(const parser::IfStmt &ifStmt) {
   // R1139 Check for a scalar logical expression
   auto &expr{std::get<parser::ScalarLogicalExpr>(ifStmt.t).thing.thing.value()};
@@ -28,10 +26,8 @@ void IfStmtChecker::Leave(const parser::IfStmt &ifStmt) {
   // C1143 Check that the action stmt is not an if stmt
   const auto &body{
       std::get<parser::UnlabeledStatement<parser::ActionStmt>>(ifStmt.t)};
-  const auto &actionStmt{body.statement};
-  if (auto *actionIfStmt{
-          std::get_if<common::Indirection<parser::IfStmt>>(&actionStmt.u)}) {
-    suppress_unused_variable_warning(*actionIfStmt);
+  if (std::holds_alternative<common::Indirection<parser::IfStmt>>(
+          body.statement.u)) {
     context_.messages().Say(
         body.source, "IF statement is not allowed in IF statement"_err_en_US);
   }