//===--- StmtCXX.h - Classes for representing C++ statements ----*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines the C++ statement AST node classes. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_STMTCXX_H #define LLVM_CLANG_AST_STMTCXX_H #include "clang/AST/DeclarationName.h" #include "clang/AST/Expr.h" #include "clang/AST/NestedNameSpecifier.h" #include "clang/AST/Stmt.h" #include "llvm/Support/Compiler.h" namespace clang { class VarDecl; /// CXXCatchStmt - This represents a C++ catch block. /// class CXXCatchStmt : public Stmt { … }; /// CXXTryStmt - A C++ try block, including all handlers. /// class CXXTryStmt final : public Stmt, private llvm::TrailingObjects<CXXTryStmt, Stmt *> { … }; /// CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for /// statement, represented as 'for (range-declarator : range-expression)' /// or 'for (init-statement range-declarator : range-expression)'. /// /// This is stored in a partially-desugared form to allow full semantic /// analysis of the constituent components. The original syntactic components /// can be extracted using getLoopVariable and getRangeInit. class CXXForRangeStmt : public Stmt { … }; /// Representation of a Microsoft __if_exists or __if_not_exists /// statement with a dependent name. /// /// The __if_exists statement can be used to include a sequence of statements /// in the program only when a particular dependent name does not exist. For /// example: /// /// \code /// template<typename T> /// void call_foo(T &t) { /// __if_exists (T::foo) { /// t.foo(); // okay: only called when T::foo exists. /// } /// } /// \endcode /// /// Similarly, the __if_not_exists statement can be used to include the /// statements when a particular name does not exist. /// /// Note that this statement only captures __if_exists and __if_not_exists /// statements whose name is dependent. All non-dependent cases are handled /// directly in the parser, so that they don't introduce a new scope. Clang /// introduces scopes in the dependent case to keep names inside the compound /// statement from leaking out into the surround statements, which would /// compromise the template instantiation model. This behavior differs from /// Visual C++ (which never introduces a scope), but is a fairly reasonable /// approximation of the VC++ behavior. class MSDependentExistsStmt : public Stmt { … }; /// Represents the body of a coroutine. This wraps the normal function /// body and holds the additional semantic context required to set up and tear /// down the coroutine frame. class CoroutineBodyStmt final : public Stmt, private llvm::TrailingObjects<CoroutineBodyStmt, Stmt *> { … }; /// Represents a 'co_return' statement in the C++ Coroutines TS. /// /// This statament models the initialization of the coroutine promise /// (encapsulating the eventual notional return value) from an expression /// (or braced-init-list), followed by termination of the coroutine. /// /// This initialization is modeled by the evaluation of the operand /// followed by a call to one of: /// <promise>.return_value(<operand>) /// <promise>.return_void() /// which we name the "promise call". class CoreturnStmt : public Stmt { … }; } // end namespace clang #endif