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-exception
6//
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 stmt
18 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::semantics
28

source code of flang/lib/Semantics/check-if-stmt.cpp