brintos

brintos / llvm-project-archived public Read only

0
0
Text · 981 B · 6aca57c Raw
28 lines · cpp
1//===-- lib/Semantics/check-if-stmt.cpp -----------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "check-if-stmt.h"10#include "flang/Parser/message.h"11#include "flang/Parser/parse-tree.h"12#include "flang/Semantics/tools.h"13 14namespace Fortran::semantics {15 16void IfStmtChecker::Leave(const parser::IfStmt &ifStmt) {17  // C1143 Check that the action stmt is not an if stmt18  const auto &body{19      std::get<parser::UnlabeledStatement<parser::ActionStmt>>(ifStmt.t)};20  if (std::holds_alternative<common::Indirection<parser::IfStmt>>(21          body.statement.u)) {22    context_.Say(23        body.source, "IF statement is not allowed in IF statement"_err_en_US);24  }25}26 27} // namespace Fortran::semantics28