[MemProf] Templatize CallStackRadixTreeBuilder (NFC) (#117014)
[llvm-project.git] / flang / lib / Semantics / check-if-stmt.cpp
blob6aca57c992078b4ee83d9f0329a4f81e4b1f5218
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 //===----------------------------------------------------------------------===//
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
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);
27 } // namespace Fortran::semantics