Files
swift-mirror/include/swift/AST/StmtNodes.def
Chris Lattner 0e7489c9d5 implement AST support for labels on loops & switch statements. This also
improves location information to track the label location in the AST.  We
don't currently track the location of the colon, but that would be trivial
to drop in if it is interesting.


Swift SVN r16608
2014-04-21 04:56:55 +00:00

58 lines
1.8 KiB
C++

//===--- StmtNodes.def - Swift Statement AST Metaprogramming ----*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines macros used for macro-metaprogramming with statements.
//
//===----------------------------------------------------------------------===//
/// STMT(Id, Parent)
/// If the statement node is not abstract, its enumerator value is
/// StmtKind::Id. The node's class name is Id##Stmt, and the name of
/// its base class (in the Stmt hierarchy) is Parent.
/// An abstract statement node is an abstract base class in the hierarchy;
/// it is never a most-derived type, and it does not have an enumerator in
/// StmtKind.
///
/// Most metaprograms do not care about abstract statements, so the default
/// is to ignore them.
#ifndef ABSTRACT_STMT
#define ABSTRACT_STMT(Id, Parent)
#endif
/// A convenience for determining the range of statements. These will always
/// appear immediately after the last member.
#ifndef STMT_RANGE
#define STMT_RANGE(Id, First, Last)
#endif
STMT(Brace, Stmt)
STMT(Return, Stmt)
STMT(If, Stmt)
ABSTRACT_STMT(Labeled, Stmt)
STMT(While, Stmt)
STMT(DoWhile, Stmt)
STMT(For, Stmt)
STMT(ForEach, Stmt)
STMT(Switch, Stmt)
STMT_RANGE(Labeled, While, Switch)
STMT(Case, Stmt)
STMT(Break, Stmt)
STMT(Continue, Stmt)
STMT(Fallthrough, Stmt)
STMT(IfConfig, Stmt)
#undef STMT_RANGE
#undef ABSTRACT_STMT
#undef STMT