1 //===-- lib/Semantics/check-if-stmt.cpp -----------------------------------===//
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
7 //===----------------------------------------------------------------------===//
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"
14 namespace Fortran::semantics
{
16 void IfStmtChecker::Leave(const parser::IfStmt
&ifStmt
) {
17 // C1143 Check that the action stmt is not an if stmt
19 std::get
<parser::UnlabeledStatement
<parser::ActionStmt
>>(ifStmt
.t
)};
20 if (std::holds_alternative
<common::Indirection
<parser::IfStmt
>>(
23 body
.source
, "IF statement is not allowed in IF statement"_err_en_US
);
27 } // namespace Fortran::semantics