1f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===--- Stmt.h - Classes for representing statements -----------*- C++ -*-===// 2f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// 3f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// The LLVM Compiler Infrastructure 4f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// 5f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// This file is distributed under the University of Illinois Open Source 6f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// License. See LICENSE.TXT for details. 7f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// 8f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===// 9f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// 10f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// This file defines the Stmt interface and subclasses. 11f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// 12f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===// 13f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 14f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#ifndef LLVM_CLANG_AST_STMT_H 15f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#define LLVM_CLANG_AST_STMT_H 16f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 17f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "clang/AST/DeclGroup.h" 18f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "clang/AST/StmtIterator.h" 19f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "clang/Basic/CapturedStmt.h" 20f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "clang/Basic/IdentifierTable.h" 21f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "clang/Basic/LLVM.h" 22f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "clang/Basic/SourceLocation.h" 23f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/ADT/ArrayRef.h" 24f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/ADT/PointerIntPair.h" 25f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/ADT/iterator.h" 26f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/Support/Compiler.h" 27f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/Support/ErrorHandling.h" 28f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include <string> 29f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 30f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotnamespace llvm { 31f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class FoldingSetNodeID; 32f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot} 33f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 34f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotnamespace clang { 35f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class ASTContext; 36f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class Attr; 37f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class CapturedDecl; 38f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class Decl; 39f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class Expr; 40f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class IdentifierInfo; 41f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class LabelDecl; 42f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class ODRHash; 43f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class ParmVarDecl; 44f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class PrinterHelper; 45f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot struct PrintingPolicy; 46f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class QualType; 47f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class RecordDecl; 48f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class SourceManager; 49f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class StringLiteral; 50f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class SwitchStmt; 51f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class Token; 52f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class VarDecl; 53f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 54f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===// 55f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// AST classes for statements. 56f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===// 57f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 58f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// Stmt - This represents one statement. 59f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 60f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass alignas(void *) Stmt { 61f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 62f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum StmtClass { 63f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot NoStmtClass = 0, 64f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#define STMT(CLASS, PARENT) CLASS##Class, 65f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#define STMT_RANGE(BASE, FIRST, LAST) \ 66f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class, 67f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#define LAST_STMT_RANGE(BASE, FIRST, LAST) \ 68f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class 69f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#define ABSTRACT_STMT(STMT) 70f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "clang/AST/StmtNodes.inc" 71f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 72f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 73f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Make vanilla 'new' and 'delete' illegal for Stmts. 74f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprotected: 75f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void *operator new(size_t bytes) noexcept { 76f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot llvm_unreachable("Stmts cannot be allocated with regular 'new'."); 77f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 78f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void operator delete(void *data) noexcept { 79f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot llvm_unreachable("Stmts cannot be released with regular 'delete'."); 80f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 81f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 82f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class StmtBitfields { 83f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class Stmt; 84f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 85f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief The statement class. 86f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned sClass : 8; 87f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 88f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum { NumStmtBits = 8 }; 89f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 90f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class CompoundStmtBitfields { 91f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class CompoundStmt; 92f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumStmtBits; 93f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 94f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumStmts : 32 - NumStmtBits; 95f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 96f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 97f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class IfStmtBitfields { 98f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class IfStmt; 99f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumStmtBits; 100f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 101f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned IsConstexpr : 1; 102f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 103f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 104f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class ExprBitfields { 105f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class Expr; 106f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class DeclRefExpr; // computeDependence 107f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class InitListExpr; // ctor 108f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class DesignatedInitExpr; // ctor 109f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class BlockDeclRefExpr; // ctor 110f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; // deserialization 111f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class CXXNewExpr; // ctor 112f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class DependentScopeDeclRefExpr; // ctor 113f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class CXXConstructExpr; // ctor 114f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class CallExpr; // ctor 115f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class OffsetOfExpr; // ctor 116f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ObjCMessageExpr; // ctor 117f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ObjCArrayLiteral; // ctor 118f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ObjCDictionaryLiteral; // ctor 119f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ShuffleVectorExpr; // ctor 120f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ParenListExpr; // ctor 121f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class CXXUnresolvedConstructExpr; // ctor 122f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class CXXDependentScopeMemberExpr; // ctor 123f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class OverloadExpr; // ctor 124f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class PseudoObjectExpr; // ctor 125f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class AtomicExpr; // ctor 126f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class OpaqueValueExpr; // ctor 127f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumStmtBits; 128f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 129f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned ValueKind : 2; 130f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned ObjectKind : 3; 131f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned TypeDependent : 1; 132f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned ValueDependent : 1; 133f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned InstantiationDependent : 1; 134f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned ContainsUnexpandedParameterPack : 1; 135f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 136f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum { NumExprBits = 17 }; 137f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 138f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class CharacterLiteralBitfields { 139f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class CharacterLiteral; 140f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 141f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 142f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned Kind : 3; 143f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 144f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 145f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum APFloatSemantics { 146f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IEEEhalf, 147f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IEEEsingle, 148f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IEEEdouble, 149f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot x87DoubleExtended, 150f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IEEEquad, 151f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot PPCDoubleDouble 152f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 153f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 154f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class FloatingLiteralBitfields { 155f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class FloatingLiteral; 156f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 157f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 158f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned Semantics : 3; // Provides semantics for APFloat construction 159f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned IsExact : 1; 160f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 161f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 162f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class UnaryExprOrTypeTraitExprBitfields { 163f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class UnaryExprOrTypeTraitExpr; 164f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 165f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 166f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned Kind : 2; 167f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned IsType : 1; // true if operand is a type, false if an expression. 168f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 169f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 170f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class DeclRefExprBitfields { 171f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class DeclRefExpr; 172f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; // deserialization 173f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 174f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 175f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned HasQualifier : 1; 176f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned HasTemplateKWAndArgsInfo : 1; 177f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned HasFoundDecl : 1; 178f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned HadMultipleCandidates : 1; 179f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned RefersToEnclosingVariableOrCapture : 1; 180f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 181f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 182f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class CastExprBitfields { 183f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class CastExpr; 184f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 185f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 186f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned Kind : 6; 187f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned BasePathSize : 32 - 6 - NumExprBits; 188f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 189f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 190f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class CallExprBitfields { 191f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class CallExpr; 192f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 193f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 194f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumPreArgs : 1; 195f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 196f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 197f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class ExprWithCleanupsBitfields { 198f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ExprWithCleanups; 199f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; // deserialization 200f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 201f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 202f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 203f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // When false, it must not have side effects. 204f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned CleanupsHaveSideEffects : 1; 205f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 206f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumObjects : 32 - 1 - NumExprBits; 207f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 208f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 209f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class PseudoObjectExprBitfields { 210f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class PseudoObjectExpr; 211f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; // deserialization 212f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 213f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 214f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 215f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // These don't need to be particularly wide, because they're 216f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // strictly limited by the forms of expressions we permit. 217f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumSubExprs : 8; 218f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned ResultIndex : 32 - 8 - NumExprBits; 219f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 220f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 221f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class ObjCIndirectCopyRestoreExprBitfields { 222f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ObjCIndirectCopyRestoreExpr; 223f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 224f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 225f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned ShouldCopy : 1; 226f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 227f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 228f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class InitListExprBitfields { 229f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class InitListExpr; 230f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 231f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 232f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 233f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Whether this initializer list originally had a GNU array-range 234f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// designator in it. This is a temporary marker used by CodeGen. 235f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned HadArrayRangeDesignator : 1; 236f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 237f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 238f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class TypeTraitExprBitfields { 239f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class TypeTraitExpr; 240f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 241f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtWriter; 242f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 243f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 244f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 245f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief The kind of type trait, which is a value of a TypeTrait enumerator. 246f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned Kind : 8; 247f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 248f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief If this expression is not value-dependent, this indicates whether 249f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// the trait evaluated true or false. 250f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned Value : 1; 251f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 252f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief The number of arguments to this type trait. 253f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumArgs : 32 - 8 - 1 - NumExprBits; 254f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 255f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 256f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class CoawaitExprBitfields { 257f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class CoawaitExpr; 258f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 259f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned : NumExprBits; 260f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 261f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned IsImplicit : 1; 262f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 263f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 264f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot union { 265f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StmtBitfields StmtBits; 266f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CompoundStmtBitfields CompoundStmtBits; 267f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IfStmtBitfields IfStmtBits; 268f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ExprBitfields ExprBits; 269f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CharacterLiteralBitfields CharacterLiteralBits; 270f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot FloatingLiteralBitfields FloatingLiteralBits; 271f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits; 272f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot DeclRefExprBitfields DeclRefExprBits; 273f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CastExprBitfields CastExprBits; 274f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CallExprBitfields CallExprBits; 275f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ExprWithCleanupsBitfields ExprWithCleanupsBits; 276f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot PseudoObjectExprBitfields PseudoObjectExprBits; 277f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits; 278f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot InitListExprBitfields InitListExprBits; 279f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot TypeTraitExprBitfields TypeTraitExprBits; 280f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CoawaitExprBitfields CoawaitBits; 281f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 282f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 283f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 284f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtWriter; 285f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 286f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 287f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Only allow allocation of Stmts using the allocator in ASTContext 288f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // or by doing a placement new. 289f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void* operator new(size_t bytes, const ASTContext& C, 290f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned alignment = 8); 291f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 292f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void* operator new(size_t bytes, const ASTContext* C, 293f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned alignment = 8) { 294f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return operator new(bytes, *C, alignment); 295f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 296f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 297f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void *operator new(size_t bytes, void *mem) noexcept { return mem; } 298f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 299f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void operator delete(void *, const ASTContext &, unsigned) noexcept {} 300f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void operator delete(void *, const ASTContext *, unsigned) noexcept {} 301f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void operator delete(void *, size_t) noexcept {} 302f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void operator delete(void *, void *) noexcept {} 303f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 304f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 305f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief A placeholder type used to construct an empty shell of a 306f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// type, that will be filled in later (e.g., by some 307f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// de-serialization). 308f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot struct EmptyShell { }; 309f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 310f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprotected: 311f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Iterator for iterating over Stmt * arrays that contain only Expr * 312f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 313f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// This is needed because AST nodes use Stmt* arrays to store 314f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// references to children (to be compatible with StmtIterator). 315f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot struct ExprIterator 316f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : llvm::iterator_adaptor_base<ExprIterator, Stmt **, 317f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot std::random_access_iterator_tag, Expr *> { 318f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ExprIterator() : iterator_adaptor_base(nullptr) {} 319f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ExprIterator(Stmt **I) : iterator_adaptor_base(I) {} 320f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 321f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot reference operator*() const { 322f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot assert((*I)->getStmtClass() >= firstExprConstant && 323f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot (*I)->getStmtClass() <= lastExprConstant); 324f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return *reinterpret_cast<Expr **>(I); 325f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 326f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 327f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 328f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Const iterator for iterating over Stmt * arrays that contain only Expr * 329f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot struct ConstExprIterator 330f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : llvm::iterator_adaptor_base<ConstExprIterator, const Stmt *const *, 331f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot std::random_access_iterator_tag, 332f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *const> { 333f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ConstExprIterator() : iterator_adaptor_base(nullptr) {} 334f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ConstExprIterator(const Stmt *const *I) : iterator_adaptor_base(I) {} 335f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 336f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot reference operator*() const { 337f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot assert((*I)->getStmtClass() >= firstExprConstant && 338f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot (*I)->getStmtClass() <= lastExprConstant); 339f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return *reinterpret_cast<const Expr *const *>(I); 340f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 341f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 342f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 343f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprivate: 344f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Whether statistic collection is enabled. 345f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool StatisticsEnabled; 346f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 347f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprotected: 348f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Construct an empty statement. 349f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit Stmt(StmtClass SC, EmptyShell) : Stmt(SC) {} 350f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 351f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 352f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt(StmtClass SC) { 353f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static_assert(sizeof(*this) == sizeof(void *), 354f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot "changing bitfields changed sizeof(Stmt)"); 355f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static_assert(sizeof(*this) % alignof(void *) == 0, 356f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot "Insufficient alignment!"); 357f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StmtBits.sClass = SC; 358f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot if (StatisticsEnabled) Stmt::addStmtClass(SC); 359f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 360f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 361f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StmtClass getStmtClass() const { 362f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return static_cast<StmtClass>(StmtBits.sClass); 363f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 364f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const char *getStmtClassName() const; 365f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 366f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// SourceLocation tokens are not useful in isolation - they are low level 367f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// value objects created/interpreted by SourceManager. We assume AST 368f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// clients will have a pointer to the respective SourceManager. 369f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceRange getSourceRange() const LLVM_READONLY; 370f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY; 371f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY; 372f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 373f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // global temp stats (until we have a per-module visitor) 374f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static void addStmtClass(const StmtClass s); 375f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static void EnableStatistics(); 376f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static void PrintStats(); 377f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 378f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Dumps the specified AST fragment and all subtrees to 379f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \c llvm::errs(). 380f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void dump() const; 381f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void dump(SourceManager &SM) const; 382f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void dump(raw_ostream &OS, SourceManager &SM) const; 383f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void dump(raw_ostream &OS) const; 384f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 385f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// dumpColor - same as dump(), but forces color highlighting. 386f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void dumpColor() const; 387f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 388f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// dumpPretty/printPretty - These two methods do a "pretty print" of the AST 389f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// back to its original source language syntax. 390f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void dumpPretty(const ASTContext &Context) const; 391f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void printPretty(raw_ostream &OS, PrinterHelper *Helper, 392f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const PrintingPolicy &Policy, 393f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned Indentation = 0) const; 394f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 395f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// viewAST - Visualize an AST rooted at this Stmt* using GraphViz. Only 396f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// works on systems with GraphViz (Mac OS X) or dot+gv installed. 397f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void viewAST() const; 398f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 399f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Skip past any implicit AST nodes which might surround this 400f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// statement, such as ExprWithCleanups or ImplicitCastExpr nodes. 401f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *IgnoreImplicit(); 402f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *IgnoreImplicit() const { 403f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_cast<Stmt *>(this)->IgnoreImplicit(); 404f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 405f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 406f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Skip no-op (attributed, compound) container stmts and skip captured 407f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// stmt at the top, if \a IgnoreCaptured is true. 408f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *IgnoreContainers(bool IgnoreCaptured = false); 409f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 410f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *stripLabelLikeStatements() const; 411f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *stripLabelLikeStatements() { 412f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_cast<Stmt*>( 413f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_cast<const Stmt*>(this)->stripLabelLikeStatements()); 414f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 415f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 416f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Child Iterators: All subclasses must implement 'children' 417f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// to permit easy iteration over the substatements/subexpessions of an 418f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// AST node. This permits easy iteration over all nodes in the AST. 419f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef StmtIterator child_iterator; 420f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef ConstStmtIterator const_child_iterator; 421f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 422f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<child_iterator> child_range; 423f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<const_child_iterator> const_child_range; 424f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 425f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children(); 426f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_child_range children() const { 427f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot auto Children = const_cast<Stmt *>(this)->children(); 428f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_child_range(Children.begin(), Children.end()); 429f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 430f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 431f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_iterator child_begin() { return children().begin(); } 432f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_iterator child_end() { return children().end(); } 433f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 434f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_child_iterator child_begin() const { return children().begin(); } 435f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_child_iterator child_end() const { return children().end(); } 436f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 437f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Produce a unique representation of the given statement. 438f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 439f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param ID once the profiling operation is complete, will contain 440f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// the unique representation of the given statement. 441f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 442f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param Context the AST context in which the statement resides 443f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 444f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param Canonical whether the profile should be based on the canonical 445f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// representation of this statement (e.g., where non-type template 446f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// parameters are identified by index/level rather than their 447f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// declaration pointers) or the exact representation of the statement as 448f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// written in the source. 449f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, 450f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool Canonical) const; 451f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 452f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Calculate a unique representation for a statement that is 453f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// stable across compiler invocations. 454f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 455f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param ID profile information will be stored in ID. 456f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 457f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param Hash an ODRHash object which will be called where pointers would 458f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// have been used in the Profile function. 459f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash& Hash) const; 460f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 461f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 462f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// DeclStmt - Adaptor class for mixing declarations with statements and 463f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// expressions. For example, CompoundStmt mixes statements, expressions 464f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// and declarations (variables, types). Another example is ForStmt, where 465f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// the first statement can be an expression or a declaration. 466f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 467f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass DeclStmt : public Stmt { 468f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot DeclGroupRef DG; 469f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation StartLoc, EndLoc; 470f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 471f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 472f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot DeclStmt(DeclGroupRef dg, SourceLocation startLoc, 473f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation endLoc) : Stmt(DeclStmtClass), DG(dg), 474f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StartLoc(startLoc), EndLoc(endLoc) {} 475f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 476f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty declaration statement. 477f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit DeclStmt(EmptyShell Empty) : Stmt(DeclStmtClass, Empty) { } 478f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 479f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// isSingleDecl - This method returns true if this DeclStmt refers 480f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// to a single Decl. 481f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isSingleDecl() const { 482f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return DG.isSingleDecl(); 483f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 484f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 485f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Decl *getSingleDecl() const { return DG.getSingleDecl(); } 486f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Decl *getSingleDecl() { return DG.getSingleDecl(); } 487f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 488f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const DeclGroupRef getDeclGroup() const { return DG; } 489f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot DeclGroupRef getDeclGroup() { return DG; } 490f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setDeclGroup(DeclGroupRef DGR) { DG = DGR; } 491f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 492f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getStartLoc() const { return StartLoc; } 493f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setStartLoc(SourceLocation L) { StartLoc = L; } 494f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getEndLoc() const { return EndLoc; } 495f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setEndLoc(SourceLocation L) { EndLoc = L; } 496f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 497f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return StartLoc; } 498f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return EndLoc; } 499f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 500f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 501f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == DeclStmtClass; 502f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 503f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 504f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators over subexpressions. 505f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 506f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(child_iterator(DG.begin(), DG.end()), 507f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_iterator(DG.end(), DG.end())); 508f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 509f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 510f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef DeclGroupRef::iterator decl_iterator; 511f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef DeclGroupRef::const_iterator const_decl_iterator; 512f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<decl_iterator> decl_range; 513f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<const_decl_iterator> decl_const_range; 514f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 515f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot decl_range decls() { return decl_range(decl_begin(), decl_end()); } 516f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot decl_const_range decls() const { 517f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return decl_const_range(decl_begin(), decl_end()); 518f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 519f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot decl_iterator decl_begin() { return DG.begin(); } 520f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot decl_iterator decl_end() { return DG.end(); } 521f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_decl_iterator decl_begin() const { return DG.begin(); } 522f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_decl_iterator decl_end() const { return DG.end(); } 523f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 524f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef std::reverse_iterator<decl_iterator> reverse_decl_iterator; 525f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot reverse_decl_iterator decl_rbegin() { 526f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reverse_decl_iterator(decl_end()); 527f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 528f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot reverse_decl_iterator decl_rend() { 529f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reverse_decl_iterator(decl_begin()); 530f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 531f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 532f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 533f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// NullStmt - This is the null statement ";": C99 6.8.3p3. 534f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 535f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass NullStmt : public Stmt { 536f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation SemiLoc; 537f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 538f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief True if the null statement was preceded by an empty macro, e.g: 539f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// @code 540f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// #define CALL(x) 541f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// CALL(0); 542f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// @endcode 543f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool HasLeadingEmptyMacro; 544f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 545f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot NullStmt(SourceLocation L, bool hasLeadingEmptyMacro = false) 546f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(NullStmtClass), SemiLoc(L), 547f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot HasLeadingEmptyMacro(hasLeadingEmptyMacro) {} 548f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 549f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty null statement. 550f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit NullStmt(EmptyShell Empty) : Stmt(NullStmtClass, Empty), 551f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot HasLeadingEmptyMacro(false) { } 552f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 553f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getSemiLoc() const { return SemiLoc; } 554f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setSemiLoc(SourceLocation L) { SemiLoc = L; } 555f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 556f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool hasLeadingEmptyMacro() const { return HasLeadingEmptyMacro; } 557f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 558f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return SemiLoc; } 559f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return SemiLoc; } 560f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 561f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 562f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == NullStmtClass; 563f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 564f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 565f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 566f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(child_iterator(), child_iterator()); 567f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 568f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 569f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 570f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtWriter; 571f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 572f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 573f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// CompoundStmt - This represents a group of statements like { stmt stmt }. 574f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 575f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass CompoundStmt : public Stmt { 576f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt** Body; 577f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation LBraceLoc, RBraceLoc; 578f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 579f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 580f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 581f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 582f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CompoundStmt(const ASTContext &C, ArrayRef<Stmt*> Stmts, 583f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation LB, SourceLocation RB); 584f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 585f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // \brief Build an empty compound statement with a location. 586f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit CompoundStmt(SourceLocation Loc) 587f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(CompoundStmtClass), Body(nullptr), LBraceLoc(Loc), RBraceLoc(Loc) { 588f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CompoundStmtBits.NumStmts = 0; 589f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 590f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 591f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // \brief Build an empty compound statement. 592f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit CompoundStmt(EmptyShell Empty) 593f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(CompoundStmtClass, Empty), Body(nullptr) { 594f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CompoundStmtBits.NumStmts = 0; 595f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 596f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 597f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setStmts(const ASTContext &C, ArrayRef<Stmt *> Stmts); 598f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 599f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool body_empty() const { return CompoundStmtBits.NumStmts == 0; } 600f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned size() const { return CompoundStmtBits.NumStmts; } 601f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 602f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef Stmt** body_iterator; 603f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<body_iterator> body_range; 604f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 605f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot body_range body() { return body_range(body_begin(), body_end()); } 606f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot body_iterator body_begin() { return Body; } 607f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot body_iterator body_end() { return Body + size(); } 608f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *body_front() { return !body_empty() ? Body[0] : nullptr; } 609f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *body_back() { return !body_empty() ? Body[size()-1] : nullptr; } 610f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 611f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setLastStmt(Stmt *S) { 612f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot assert(!body_empty() && "setLastStmt"); 613f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Body[size()-1] = S; 614f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 615f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 616f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef Stmt* const * const_body_iterator; 617f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<const_body_iterator> body_const_range; 618f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 619f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot body_const_range body() const { 620f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return body_const_range(body_begin(), body_end()); 621f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 622f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_body_iterator body_begin() const { return Body; } 623f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_body_iterator body_end() const { return Body + size(); } 624f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *body_front() const { 625f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return !body_empty() ? Body[0] : nullptr; 626f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 627f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *body_back() const { 628f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return !body_empty() ? Body[size() - 1] : nullptr; 629f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 630f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 631f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef std::reverse_iterator<body_iterator> reverse_body_iterator; 632f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot reverse_body_iterator body_rbegin() { 633f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reverse_body_iterator(body_end()); 634f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 635f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot reverse_body_iterator body_rend() { 636f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reverse_body_iterator(body_begin()); 637f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 638f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 639f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef std::reverse_iterator<const_body_iterator> 640f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_reverse_body_iterator; 641f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 642f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_reverse_body_iterator body_rbegin() const { 643f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_reverse_body_iterator(body_end()); 644f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 645f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 646f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_reverse_body_iterator body_rend() const { 647f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_reverse_body_iterator(body_begin()); 648f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 649f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 650f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return LBraceLoc; } 651f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return RBraceLoc; } 652f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 653f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLBracLoc() const { return LBraceLoc; } 654f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getRBracLoc() const { return RBraceLoc; } 655f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 656f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 657f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == CompoundStmtClass; 658f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 659f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 660f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 661f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 662f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(Body, Body + CompoundStmtBits.NumStmts); 663f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 664f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 665f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_child_range children() const { 666f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_child_range(child_iterator(Body), 667f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_iterator(Body + CompoundStmtBits.NumStmts)); 668f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 669f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 670f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 671f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// SwitchCase is the base class for CaseStmt and DefaultStmt, 672f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass SwitchCase : public Stmt { 673f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprotected: 674f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // A pointer to the following CaseStmt or DefaultStmt class, 675f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // used by SwitchStmt. 676f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SwitchCase *NextSwitchCase; 677f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation KeywordLoc; 678f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation ColonLoc; 679f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 680f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SwitchCase(StmtClass SC, SourceLocation KWLoc, SourceLocation ColonLoc) 681f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(SC), NextSwitchCase(nullptr), KeywordLoc(KWLoc), ColonLoc(ColonLoc) { 682f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 683f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 684f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SwitchCase(StmtClass SC, EmptyShell) 685f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(SC), NextSwitchCase(nullptr) {} 686f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 687f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 688f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const SwitchCase *getNextSwitchCase() const { return NextSwitchCase; } 689f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 690f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SwitchCase *getNextSwitchCase() { return NextSwitchCase; } 691f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 692f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setNextSwitchCase(SwitchCase *SC) { NextSwitchCase = SC; } 693f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 694f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getKeywordLoc() const { return KeywordLoc; } 695f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setKeywordLoc(SourceLocation L) { KeywordLoc = L; } 696f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getColonLoc() const { return ColonLoc; } 697f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setColonLoc(SourceLocation L) { ColonLoc = L; } 698f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 699f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getSubStmt(); 700f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getSubStmt() const { 701f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_cast<SwitchCase*>(this)->getSubStmt(); 702f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 703f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 704f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; } 705f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY; 706f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 707f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 708f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == CaseStmtClass || 709f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot T->getStmtClass() == DefaultStmtClass; 710f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 711f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 712f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 713f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass CaseStmt : public SwitchCase { 714f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation EllipsisLoc; 715f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum { LHS, RHS, SUBSTMT, END_EXPR }; 716f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt* SubExprs[END_EXPR]; // The expression for the RHS is Non-null for 717f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // GNU "case 1 ... 4" extension 718f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 719f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc, 720f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation ellipsisLoc, SourceLocation colonLoc) 721f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : SwitchCase(CaseStmtClass, caseLoc, colonLoc) { 722f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SubExprs[SUBSTMT] = nullptr; 723f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SubExprs[LHS] = reinterpret_cast<Stmt*>(lhs); 724f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SubExprs[RHS] = reinterpret_cast<Stmt*>(rhs); 725f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot EllipsisLoc = ellipsisLoc; 726f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 727f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 728f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty switch case statement. 729f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit CaseStmt(EmptyShell Empty) : SwitchCase(CaseStmtClass, Empty) { } 730f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 731f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getCaseLoc() const { return KeywordLoc; } 732f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setCaseLoc(SourceLocation L) { KeywordLoc = L; } 733f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getEllipsisLoc() const { return EllipsisLoc; } 734f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setEllipsisLoc(SourceLocation L) { EllipsisLoc = L; } 735f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getColonLoc() const { return ColonLoc; } 736f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setColonLoc(SourceLocation L) { ColonLoc = L; } 737f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 738f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getLHS() { return reinterpret_cast<Expr*>(SubExprs[LHS]); } 739f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getRHS() { return reinterpret_cast<Expr*>(SubExprs[RHS]); } 740f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getSubStmt() { return SubExprs[SUBSTMT]; } 741f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 742f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getLHS() const { 743f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<const Expr*>(SubExprs[LHS]); 744f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 745f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getRHS() const { 746f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<const Expr*>(SubExprs[RHS]); 747f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 748f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getSubStmt() const { return SubExprs[SUBSTMT]; } 749f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 750f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setSubStmt(Stmt *S) { SubExprs[SUBSTMT] = S; } 751f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setLHS(Expr *Val) { SubExprs[LHS] = reinterpret_cast<Stmt*>(Val); } 752f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setRHS(Expr *Val) { SubExprs[RHS] = reinterpret_cast<Stmt*>(Val); } 753f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 754f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; } 755f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { 756f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Handle deeply nested case statements with iteration instead of recursion. 757f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const CaseStmt *CS = this; 758f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot while (const CaseStmt *CS2 = dyn_cast<CaseStmt>(CS->getSubStmt())) 759f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CS = CS2; 760f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 761f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return CS->getSubStmt()->getLocEnd(); 762f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 763f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 764f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 765f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == CaseStmtClass; 766f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 767f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 768f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 769f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 770f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(&SubExprs[0], &SubExprs[END_EXPR]); 771f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 772f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 773f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 774f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass DefaultStmt : public SwitchCase { 775f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt* SubStmt; 776f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 777f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt) : 778f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {} 779f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 780f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty default statement. 781f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit DefaultStmt(EmptyShell Empty) 782f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : SwitchCase(DefaultStmtClass, Empty) { } 783f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 784f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getSubStmt() { return SubStmt; } 785f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getSubStmt() const { return SubStmt; } 786f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setSubStmt(Stmt *S) { SubStmt = S; } 787f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 788f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getDefaultLoc() const { return KeywordLoc; } 789f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setDefaultLoc(SourceLocation L) { KeywordLoc = L; } 790f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getColonLoc() const { return ColonLoc; } 791f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setColonLoc(SourceLocation L) { ColonLoc = L; } 792f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 793f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; } 794f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();} 795f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 796f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 797f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == DefaultStmtClass; 798f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 799f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 800f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 801f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { return child_range(&SubStmt, &SubStmt+1); } 802f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 803f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 804f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotinline SourceLocation SwitchCase::getLocEnd() const { 805f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot if (const CaseStmt *CS = dyn_cast<CaseStmt>(this)) 806f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return CS->getLocEnd(); 807f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return cast<DefaultStmt>(this)->getLocEnd(); 808f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot} 809f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 810f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// LabelStmt - Represents a label, which has a substatement. For example: 811f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// foo: return; 812f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 813f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass LabelStmt : public Stmt { 814f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation IdentLoc; 815f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot LabelDecl *TheDecl; 816f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *SubStmt; 817f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 818f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 819f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt) 820f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(LabelStmtClass), IdentLoc(IL), TheDecl(D), SubStmt(substmt) { 821f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static_assert(sizeof(LabelStmt) == 822f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2 * sizeof(SourceLocation) + 2 * sizeof(void *), 823f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot "LabelStmt too big"); 824f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 825f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 826f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // \brief Build an empty label statement. 827f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit LabelStmt(EmptyShell Empty) : Stmt(LabelStmtClass, Empty) { } 828f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 829f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getIdentLoc() const { return IdentLoc; } 830f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot LabelDecl *getDecl() const { return TheDecl; } 831f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setDecl(LabelDecl *D) { TheDecl = D; } 832f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const char *getName() const; 833f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getSubStmt() { return SubStmt; } 834f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getSubStmt() const { return SubStmt; } 835f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setIdentLoc(SourceLocation L) { IdentLoc = L; } 836f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setSubStmt(Stmt *SS) { SubStmt = SS; } 837f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 838f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return IdentLoc; } 839f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();} 840f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 841f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { return child_range(&SubStmt, &SubStmt+1); } 842f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 843f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 844f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == LabelStmtClass; 845f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 846f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 847f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 848f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 849f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// \brief Represents an attribute applied to a statement. 850f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 851f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// Represents an attribute applied to a statement. For example: 852f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// [[omp::for(...)]] for (...) { ... } 853f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 854f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass AttributedStmt : public Stmt { 855f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *SubStmt; 856f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation AttrLoc; 857f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumAttrs; 858f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 859f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 860f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 861f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot AttributedStmt(SourceLocation Loc, ArrayRef<const Attr*> Attrs, Stmt *SubStmt) 862f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(AttributedStmtClass), SubStmt(SubStmt), AttrLoc(Loc), 863f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot NumAttrs(Attrs.size()) { 864f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr()); 865f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 866f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 867f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit AttributedStmt(EmptyShell Empty, unsigned NumAttrs) 868f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(AttributedStmtClass, Empty), NumAttrs(NumAttrs) { 869f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot std::fill_n(getAttrArrayPtr(), NumAttrs, nullptr); 870f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 871f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 872f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Attr *const *getAttrArrayPtr() const { 873f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<const Attr *const *>(this + 1); 874f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 875f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Attr **getAttrArrayPtr() { 876f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<const Attr **>(this + 1); 877f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 878f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 879f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 880f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static AttributedStmt *Create(const ASTContext &C, SourceLocation Loc, 881f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<const Attr*> Attrs, Stmt *SubStmt); 882f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // \brief Build an empty attributed statement. 883f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static AttributedStmt *CreateEmpty(const ASTContext &C, unsigned NumAttrs); 884f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 885f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getAttrLoc() const { return AttrLoc; } 886f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<const Attr*> getAttrs() const { 887f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return llvm::makeArrayRef(getAttrArrayPtr(), NumAttrs); 888f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 889f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getSubStmt() { return SubStmt; } 890f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getSubStmt() const { return SubStmt; } 891f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 892f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return AttrLoc; } 893f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();} 894f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 895f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { return child_range(&SubStmt, &SubStmt + 1); } 896f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 897f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 898f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == AttributedStmtClass; 899f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 900f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 901f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 902f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 903f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// IfStmt - This represents an if/then/else. 904f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 905f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass IfStmt : public Stmt { 906f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum { INIT, VAR, COND, THEN, ELSE, END_EXPR }; 907f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt* SubExprs[END_EXPR]; 908f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 909f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation IfLoc; 910f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation ElseLoc; 911f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 912f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 913f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IfStmt(const ASTContext &C, SourceLocation IL, 914f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool IsConstexpr, Stmt *init, VarDecl *var, Expr *cond, 915f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *then, SourceLocation EL = SourceLocation(), 916f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *elsev = nullptr); 917f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 918f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty if/then/else statement 919f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit IfStmt(EmptyShell Empty) : Stmt(IfStmtClass, Empty) { } 920f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 921f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the variable declared in this "if" statement, if any. 922f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 923f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// In the following example, "x" is the condition variable. 924f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \code 925f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// if (int x = foo()) { 926f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// printf("x is %d", x); 927f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// } 928f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \endcode 929f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VarDecl *getConditionVariable() const; 930f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setConditionVariable(const ASTContext &C, VarDecl *V); 931f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 932f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// If this IfStmt has a condition variable, return the faux DeclStmt 933f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// associated with the creation of that condition variable. 934f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const DeclStmt *getConditionVariableDeclStmt() const { 935f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<DeclStmt*>(SubExprs[VAR]); 936f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 937f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 938f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getInit() { return SubExprs[INIT]; } 939f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getInit() const { return SubExprs[INIT]; } 940f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setInit(Stmt *S) { SubExprs[INIT] = S; } 941f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);} 942f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); } 943f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getThen() const { return SubExprs[THEN]; } 944f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setThen(Stmt *S) { SubExprs[THEN] = S; } 945f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getElse() const { return SubExprs[ELSE]; } 946f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setElse(Stmt *S) { SubExprs[ELSE] = S; } 947f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 948f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); } 949f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getThen() { return SubExprs[THEN]; } 950f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getElse() { return SubExprs[ELSE]; } 951f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 952f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getIfLoc() const { return IfLoc; } 953f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setIfLoc(SourceLocation L) { IfLoc = L; } 954f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getElseLoc() const { return ElseLoc; } 955f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setElseLoc(SourceLocation L) { ElseLoc = L; } 956f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 957f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isConstexpr() const { return IfStmtBits.IsConstexpr; } 958f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setConstexpr(bool C) { IfStmtBits.IsConstexpr = C; } 959f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 960f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isObjCAvailabilityCheck() const; 961f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 962f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return IfLoc; } 963f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { 964f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot if (SubExprs[ELSE]) 965f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return SubExprs[ELSE]->getLocEnd(); 966f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot else 967f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return SubExprs[THEN]->getLocEnd(); 968f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 969f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 970f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators over subexpressions. The iterators will include iterating 971f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // over the initialization expression referenced by the condition variable. 972f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 973f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR); 974f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 975f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 976f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 977f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == IfStmtClass; 978f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 979f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 980f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 981f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// SwitchStmt - This represents a 'switch' stmt. 982f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 983f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass SwitchStmt : public Stmt { 984f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation SwitchLoc; 985f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum { INIT, VAR, COND, BODY, END_EXPR }; 986f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt* SubExprs[END_EXPR]; 987f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // This points to a linked list of case and default statements and, if the 988f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // SwitchStmt is a switch on an enum value, records whether all the enum 989f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // values were covered by CaseStmts. The coverage information value is meant 990f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // to be a hint for possible clients. 991f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot llvm::PointerIntPair<SwitchCase *, 1, bool> FirstCase; 992f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 993f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 994f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SwitchStmt(const ASTContext &C, Stmt *Init, VarDecl *Var, Expr *cond); 995f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 996f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build a empty switch statement. 997f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit SwitchStmt(EmptyShell Empty) : Stmt(SwitchStmtClass, Empty) { } 998f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 999f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the variable declared in this "switch" statement, if any. 1000f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 1001f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// In the following example, "x" is the condition variable. 1002f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \code 1003f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// switch (int x = foo()) { 1004f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// case 0: break; 1005f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// // ... 1006f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// } 1007f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \endcode 1008f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VarDecl *getConditionVariable() const; 1009f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setConditionVariable(const ASTContext &C, VarDecl *V); 1010f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1011f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// If this SwitchStmt has a condition variable, return the faux DeclStmt 1012f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// associated with the creation of that condition variable. 1013f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const DeclStmt *getConditionVariableDeclStmt() const { 1014f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<DeclStmt*>(SubExprs[VAR]); 1015f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1016f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1017f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getInit() { return SubExprs[INIT]; } 1018f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getInit() const { return SubExprs[INIT]; } 1019f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setInit(Stmt *S) { SubExprs[INIT] = S; } 1020f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);} 1021f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getBody() const { return SubExprs[BODY]; } 1022f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const SwitchCase *getSwitchCaseList() const { return FirstCase.getPointer(); } 1023f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1024f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]);} 1025f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); } 1026f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getBody() { return SubExprs[BODY]; } 1027f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setBody(Stmt *S) { SubExprs[BODY] = S; } 1028f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SwitchCase *getSwitchCaseList() { return FirstCase.getPointer(); } 1029f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1030f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Set the case list for this switch statement. 1031f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setSwitchCaseList(SwitchCase *SC) { FirstCase.setPointer(SC); } 1032f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1033f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getSwitchLoc() const { return SwitchLoc; } 1034f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setSwitchLoc(SourceLocation L) { SwitchLoc = L; } 1035f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1036f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setBody(Stmt *S, SourceLocation SL) { 1037f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SubExprs[BODY] = S; 1038f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SwitchLoc = SL; 1039f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1040f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void addSwitchCase(SwitchCase *SC) { 1041f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot assert(!SC->getNextSwitchCase() 1042f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot && "case/default already added to a switch"); 1043f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SC->setNextSwitchCase(FirstCase.getPointer()); 1044f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot FirstCase.setPointer(SC); 1045f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1046f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1047f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a 1048f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// switch over an enum value then all cases have been explicitly covered. 1049f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setAllEnumCasesCovered() { FirstCase.setInt(true); } 1050f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1051f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Returns true if the SwitchStmt is a switch of an enum value and all cases 1052f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// have been explicitly covered. 1053f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isAllEnumCasesCovered() const { return FirstCase.getInt(); } 1054f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1055f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return SwitchLoc; } 1056f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { 1057f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return SubExprs[BODY] ? SubExprs[BODY]->getLocEnd() : SubExprs[COND]->getLocEnd(); 1058f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1059f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1060f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 1061f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1062f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR); 1063f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1064f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1065f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1066f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == SwitchStmtClass; 1067f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1068f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1069f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1070f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1071f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// WhileStmt - This represents a 'while' stmt. 1072f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1073f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass WhileStmt : public Stmt { 1074f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation WhileLoc; 1075f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum { VAR, COND, BODY, END_EXPR }; 1076f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt* SubExprs[END_EXPR]; 1077f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1078f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot WhileStmt(const ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body, 1079f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation WL); 1080f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1081f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty while statement. 1082f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit WhileStmt(EmptyShell Empty) : Stmt(WhileStmtClass, Empty) { } 1083f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1084f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the variable declared in this "while" statement, if any. 1085f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 1086f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// In the following example, "x" is the condition variable. 1087f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \code 1088f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// while (int x = random()) { 1089f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// // ... 1090f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// } 1091f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \endcode 1092f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VarDecl *getConditionVariable() const; 1093f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setConditionVariable(const ASTContext &C, VarDecl *V); 1094f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1095f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// If this WhileStmt has a condition variable, return the faux DeclStmt 1096f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// associated with the creation of that condition variable. 1097f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const DeclStmt *getConditionVariableDeclStmt() const { 1098f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<DeclStmt*>(SubExprs[VAR]); 1099f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1100f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1101f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); } 1102f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);} 1103f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); } 1104f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getBody() { return SubExprs[BODY]; } 1105f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getBody() const { return SubExprs[BODY]; } 1106f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setBody(Stmt *S) { SubExprs[BODY] = S; } 1107f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1108f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getWhileLoc() const { return WhileLoc; } 1109f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setWhileLoc(SourceLocation L) { WhileLoc = L; } 1110f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1111f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return WhileLoc; } 1112f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { 1113f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return SubExprs[BODY]->getLocEnd(); 1114f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1115f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1116f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1117f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == WhileStmtClass; 1118f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1119f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1120f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 1121f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1122f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR); 1123f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1124f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1125f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1126f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// DoStmt - This represents a 'do/while' stmt. 1127f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1128f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass DoStmt : public Stmt { 1129f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation DoLoc; 1130f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum { BODY, COND, END_EXPR }; 1131f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt* SubExprs[END_EXPR]; 1132f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation WhileLoc; 1133f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation RParenLoc; // Location of final ')' in do stmt condition. 1134f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1135f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1136f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot DoStmt(Stmt *body, Expr *cond, SourceLocation DL, SourceLocation WL, 1137f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation RP) 1138f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(DoStmtClass), DoLoc(DL), WhileLoc(WL), RParenLoc(RP) { 1139f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SubExprs[COND] = reinterpret_cast<Stmt*>(cond); 1140f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SubExprs[BODY] = body; 1141f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1142f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1143f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty do-while statement. 1144f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit DoStmt(EmptyShell Empty) : Stmt(DoStmtClass, Empty) { } 1145f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1146f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); } 1147f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);} 1148f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); } 1149f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getBody() { return SubExprs[BODY]; } 1150f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getBody() const { return SubExprs[BODY]; } 1151f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setBody(Stmt *S) { SubExprs[BODY] = S; } 1152f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1153f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getDoLoc() const { return DoLoc; } 1154f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setDoLoc(SourceLocation L) { DoLoc = L; } 1155f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getWhileLoc() const { return WhileLoc; } 1156f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setWhileLoc(SourceLocation L) { WhileLoc = L; } 1157f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1158f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getRParenLoc() const { return RParenLoc; } 1159f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setRParenLoc(SourceLocation L) { RParenLoc = L; } 1160f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1161f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return DoLoc; } 1162f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; } 1163f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1164f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1165f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == DoStmtClass; 1166f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1167f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1168f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 1169f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1170f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR); 1171f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1172f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1173f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1174f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1175f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// ForStmt - This represents a 'for (init;cond;inc)' stmt. Note that any of 1176f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// the init/cond/inc parts of the ForStmt will be null if they were not 1177f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// specified in the source. 1178f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1179f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass ForStmt : public Stmt { 1180f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation ForLoc; 1181f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR }; 1182f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt* SubExprs[END_EXPR]; // SubExprs[INIT] is an expression or declstmt. 1183f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation LParenLoc, RParenLoc; 1184f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1185f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1186f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, 1187f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP, 1188f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation RP); 1189f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1190f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty for statement. 1191f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) { } 1192f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1193f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getInit() { return SubExprs[INIT]; } 1194f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1195f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the variable declared in this "for" statement, if any. 1196f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 1197f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// In the following example, "y" is the condition variable. 1198f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \code 1199f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// for (int x = random(); int y = mangle(x); ++x) { 1200f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// // ... 1201f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// } 1202f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \endcode 1203f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VarDecl *getConditionVariable() const; 1204f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setConditionVariable(const ASTContext &C, VarDecl *V); 1205f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1206f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// If this ForStmt has a condition variable, return the faux DeclStmt 1207f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// associated with the creation of that condition variable. 1208f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const DeclStmt *getConditionVariableDeclStmt() const { 1209f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]); 1210f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1211f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1212f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); } 1213f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getInc() { return reinterpret_cast<Expr*>(SubExprs[INC]); } 1214f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getBody() { return SubExprs[BODY]; } 1215f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1216f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getInit() const { return SubExprs[INIT]; } 1217f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);} 1218f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getInc() const { return reinterpret_cast<Expr*>(SubExprs[INC]); } 1219f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getBody() const { return SubExprs[BODY]; } 1220f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1221f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setInit(Stmt *S) { SubExprs[INIT] = S; } 1222f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); } 1223f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setInc(Expr *E) { SubExprs[INC] = reinterpret_cast<Stmt*>(E); } 1224f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setBody(Stmt *S) { SubExprs[BODY] = S; } 1225f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1226f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getForLoc() const { return ForLoc; } 1227f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setForLoc(SourceLocation L) { ForLoc = L; } 1228f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLParenLoc() const { return LParenLoc; } 1229f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setLParenLoc(SourceLocation L) { LParenLoc = L; } 1230f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getRParenLoc() const { return RParenLoc; } 1231f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setRParenLoc(SourceLocation L) { RParenLoc = L; } 1232f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1233f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return ForLoc; } 1234f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { 1235f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return SubExprs[BODY]->getLocEnd(); 1236f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1237f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1238f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1239f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == ForStmtClass; 1240f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1241f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1242f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 1243f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1244f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR); 1245f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1246f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1247f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1248f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// GotoStmt - This represents a direct goto. 1249f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1250f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass GotoStmt : public Stmt { 1251f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot LabelDecl *Label; 1252f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation GotoLoc; 1253f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation LabelLoc; 1254f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1255f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL) 1256f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(GotoStmtClass), Label(label), GotoLoc(GL), LabelLoc(LL) {} 1257f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1258f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty goto statement. 1259f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit GotoStmt(EmptyShell Empty) : Stmt(GotoStmtClass, Empty) { } 1260f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1261f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot LabelDecl *getLabel() const { return Label; } 1262f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setLabel(LabelDecl *D) { Label = D; } 1263f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1264f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getGotoLoc() const { return GotoLoc; } 1265f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setGotoLoc(SourceLocation L) { GotoLoc = L; } 1266f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLabelLoc() const { return LabelLoc; } 1267f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setLabelLoc(SourceLocation L) { LabelLoc = L; } 1268f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1269f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return GotoLoc; } 1270f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return LabelLoc; } 1271f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1272f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1273f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == GotoStmtClass; 1274f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1275f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1276f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 1277f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1278f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(child_iterator(), child_iterator()); 1279f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1280f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1281f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1282f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// IndirectGotoStmt - This represents an indirect goto. 1283f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1284f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass IndirectGotoStmt : public Stmt { 1285f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation GotoLoc; 1286f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation StarLoc; 1287f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *Target; 1288f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1289f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, 1290f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *target) 1291f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(IndirectGotoStmtClass), GotoLoc(gotoLoc), StarLoc(starLoc), 1292f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Target((Stmt*)target) {} 1293f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1294f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty indirect goto statement. 1295f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit IndirectGotoStmt(EmptyShell Empty) 1296f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(IndirectGotoStmtClass, Empty) { } 1297f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1298f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setGotoLoc(SourceLocation L) { GotoLoc = L; } 1299f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getGotoLoc() const { return GotoLoc; } 1300f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setStarLoc(SourceLocation L) { StarLoc = L; } 1301f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getStarLoc() const { return StarLoc; } 1302f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1303f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getTarget() { return reinterpret_cast<Expr*>(Target); } 1304f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getTarget() const {return reinterpret_cast<const Expr*>(Target);} 1305f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setTarget(Expr *E) { Target = reinterpret_cast<Stmt*>(E); } 1306f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1307f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// getConstantTarget - Returns the fixed target of this indirect 1308f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// goto, if one exists. 1309f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot LabelDecl *getConstantTarget(); 1310f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const LabelDecl *getConstantTarget() const { 1311f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_cast<IndirectGotoStmt*>(this)->getConstantTarget(); 1312f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1313f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1314f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return GotoLoc; } 1315f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return Target->getLocEnd(); } 1316f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1317f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1318f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == IndirectGotoStmtClass; 1319f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1320f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1321f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 1322f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { return child_range(&Target, &Target+1); } 1323f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1324f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1325f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1326f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// ContinueStmt - This represents a continue. 1327f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1328f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass ContinueStmt : public Stmt { 1329f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation ContinueLoc; 1330f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1331f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ContinueStmt(SourceLocation CL) : Stmt(ContinueStmtClass), ContinueLoc(CL) {} 1332f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1333f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty continue statement. 1334f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit ContinueStmt(EmptyShell Empty) : Stmt(ContinueStmtClass, Empty) { } 1335f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1336f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getContinueLoc() const { return ContinueLoc; } 1337f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setContinueLoc(SourceLocation L) { ContinueLoc = L; } 1338f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1339f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return ContinueLoc; } 1340f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return ContinueLoc; } 1341f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1342f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1343f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == ContinueStmtClass; 1344f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1345f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1346f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 1347f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1348f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(child_iterator(), child_iterator()); 1349f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1350f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1351f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1352f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// BreakStmt - This represents a break. 1353f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1354f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass BreakStmt : public Stmt { 1355f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation BreakLoc; 1356f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1357f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1358f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot BreakStmt(SourceLocation BL) : Stmt(BreakStmtClass), BreakLoc(BL) { 1359f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static_assert(sizeof(BreakStmt) == 2 * sizeof(SourceLocation), 1360f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot "BreakStmt too large"); 1361f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1362f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1363f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty break statement. 1364f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit BreakStmt(EmptyShell Empty) : Stmt(BreakStmtClass, Empty) { } 1365f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1366f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getBreakLoc() const { return BreakLoc; } 1367f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setBreakLoc(SourceLocation L) { BreakLoc = L; } 1368f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1369f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return BreakLoc; } 1370f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return BreakLoc; } 1371f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1372f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1373f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == BreakStmtClass; 1374f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1375f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1376f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 1377f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1378f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(child_iterator(), child_iterator()); 1379f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1380f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1381f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1382f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1383f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// ReturnStmt - This represents a return, optionally of an expression: 1384f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// return; 1385f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// return 4; 1386f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1387f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// Note that GCC allows return with no argument in a function declared to 1388f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// return a value, and it allows returning a value in functions declared to 1389f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// return void. We explicitly model this in the AST, which means you can't 1390f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// depend on the return type of the function and the presence of an argument. 1391f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1392f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass ReturnStmt : public Stmt { 1393f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation RetLoc; 1394f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *RetExpr; 1395f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const VarDecl *NRVOCandidate; 1396f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1397f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1398f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit ReturnStmt(SourceLocation RL) : ReturnStmt(RL, nullptr, nullptr) {} 1399f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1400f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate) 1401f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(ReturnStmtClass), RetLoc(RL), RetExpr((Stmt *)E), 1402f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot NRVOCandidate(NRVOCandidate) {} 1403f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1404f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty return expression. 1405f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit ReturnStmt(EmptyShell Empty) : Stmt(ReturnStmtClass, Empty) { } 1406f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1407f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getRetValue() const; 1408f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getRetValue(); 1409f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setRetValue(Expr *E) { RetExpr = reinterpret_cast<Stmt*>(E); } 1410f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1411f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getReturnLoc() const { return RetLoc; } 1412f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setReturnLoc(SourceLocation L) { RetLoc = L; } 1413f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1414f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the variable that might be used for the named return 1415f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// value optimization. 1416f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 1417f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// The optimization itself can only be performed if the variable is 1418f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// also marked as an NRVO object. 1419f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const VarDecl *getNRVOCandidate() const { return NRVOCandidate; } 1420f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setNRVOCandidate(const VarDecl *Var) { NRVOCandidate = Var; } 1421f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1422f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return RetLoc; } 1423f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { 1424f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return RetExpr ? RetExpr->getLocEnd() : RetLoc; 1425f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1426f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1427f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1428f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == ReturnStmtClass; 1429f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1430f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1431f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 1432f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1433f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot if (RetExpr) return child_range(&RetExpr, &RetExpr+1); 1434f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(child_iterator(), child_iterator()); 1435f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1436f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1437f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1438f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// AsmStmt is the base class for GCCAsmStmt and MSAsmStmt. 1439f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1440f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass AsmStmt : public Stmt { 1441f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprotected: 1442f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation AsmLoc; 1443f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief True if the assembly statement does not have any input or output 1444f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// operands. 1445f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool IsSimple; 1446f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1447f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief If true, treat this inline assembly as having side effects. 1448f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// This assembly statement should not be optimized, deleted or moved. 1449f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool IsVolatile; 1450f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1451f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumOutputs; 1452f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumInputs; 1453f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumClobbers; 1454f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1455f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt **Exprs; 1456f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1457f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile, 1458f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned numoutputs, unsigned numinputs, unsigned numclobbers) : 1459f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt (SC), AsmLoc(asmloc), IsSimple(issimple), IsVolatile(isvolatile), 1460f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot NumOutputs(numoutputs), NumInputs(numinputs), NumClobbers(numclobbers) { } 1461f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1462f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 1463f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1464f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1465f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty inline-assembly statement. 1466f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit AsmStmt(StmtClass SC, EmptyShell Empty) : 1467f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt(SC, Empty), Exprs(nullptr) { } 1468f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1469f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getAsmLoc() const { return AsmLoc; } 1470f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setAsmLoc(SourceLocation L) { AsmLoc = L; } 1471f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1472f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isSimple() const { return IsSimple; } 1473f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setSimple(bool V) { IsSimple = V; } 1474f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1475f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isVolatile() const { return IsVolatile; } 1476f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setVolatile(bool V) { IsVolatile = V; } 1477f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1478f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return SourceLocation(); } 1479f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return SourceLocation(); } 1480f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1481f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Asm String Analysis ---===// 1482f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1483f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Assemble final IR asm string. 1484f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot std::string generateAsmString(const ASTContext &C) const; 1485f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1486f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Output operands ---===// 1487f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1488f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned getNumOutputs() const { return NumOutputs; } 1489f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1490f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// getOutputConstraint - Return the constraint string for the specified 1491f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// output operand. All output constraints are known to be non-empty (either 1492f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// '=' or '+'). 1493f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getOutputConstraint(unsigned i) const; 1494f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1495f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// isOutputPlusConstraint - Return true if the specified output constraint 1496f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// is a "+" constraint (which is both an input and an output) or false if it 1497f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// is an "=" constraint (just an output). 1498f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isOutputPlusConstraint(unsigned i) const { 1499f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return getOutputConstraint(i)[0] == '+'; 1500f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1501f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1502f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getOutputExpr(unsigned i) const; 1503f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1504f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// getNumPlusOperands - Return the number of output operands that have a "+" 1505f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// constraint. 1506f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned getNumPlusOperands() const; 1507f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1508f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Input operands ---===// 1509f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1510f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned getNumInputs() const { return NumInputs; } 1511f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1512f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// getInputConstraint - Return the specified input constraint. Unlike output 1513f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// constraints, these can be empty. 1514f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getInputConstraint(unsigned i) const; 1515f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1516f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getInputExpr(unsigned i) const; 1517f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1518f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Other ---===// 1519f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1520f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned getNumClobbers() const { return NumClobbers; } 1521f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getClobber(unsigned i) const; 1522f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1523f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1524f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == GCCAsmStmtClass || 1525f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot T->getStmtClass() == MSAsmStmtClass; 1526f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1527f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1528f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Input expr iterators. 1529f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1530f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef ExprIterator inputs_iterator; 1531f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef ConstExprIterator const_inputs_iterator; 1532f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<inputs_iterator> inputs_range; 1533f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<const_inputs_iterator> inputs_const_range; 1534f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1535f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot inputs_iterator begin_inputs() { 1536f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return &Exprs[0] + NumOutputs; 1537f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1538f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1539f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot inputs_iterator end_inputs() { 1540f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return &Exprs[0] + NumOutputs + NumInputs; 1541f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1542f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1543f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot inputs_range inputs() { return inputs_range(begin_inputs(), end_inputs()); } 1544f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1545f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_inputs_iterator begin_inputs() const { 1546f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return &Exprs[0] + NumOutputs; 1547f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1548f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1549f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_inputs_iterator end_inputs() const { 1550f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return &Exprs[0] + NumOutputs + NumInputs; 1551f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1552f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1553f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot inputs_const_range inputs() const { 1554f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return inputs_const_range(begin_inputs(), end_inputs()); 1555f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1556f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1557f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Output expr iterators. 1558f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1559f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef ExprIterator outputs_iterator; 1560f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef ConstExprIterator const_outputs_iterator; 1561f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<outputs_iterator> outputs_range; 1562f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<const_outputs_iterator> outputs_const_range; 1563f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1564f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot outputs_iterator begin_outputs() { 1565f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return &Exprs[0]; 1566f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1567f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot outputs_iterator end_outputs() { 1568f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return &Exprs[0] + NumOutputs; 1569f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1570f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot outputs_range outputs() { 1571f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return outputs_range(begin_outputs(), end_outputs()); 1572f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1573f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1574f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_outputs_iterator begin_outputs() const { 1575f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return &Exprs[0]; 1576f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1577f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_outputs_iterator end_outputs() const { 1578f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return &Exprs[0] + NumOutputs; 1579f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1580f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot outputs_const_range outputs() const { 1581f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return outputs_const_range(begin_outputs(), end_outputs()); 1582f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1583f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1584f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1585f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs); 1586f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1587f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1588f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1589f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// This represents a GCC inline-assembly statement extension. 1590f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1591f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass GCCAsmStmt : public AsmStmt { 1592f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation RParenLoc; 1593f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral *AsmStr; 1594f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1595f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // FIXME: If we wanted to, we could allocate all of these in one big array. 1596f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral **Constraints; 1597f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral **Clobbers; 1598f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IdentifierInfo **Names; 1599f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1600f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 1601f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1602f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1603f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot GCCAsmStmt(const ASTContext &C, SourceLocation asmloc, bool issimple, 1604f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isvolatile, unsigned numoutputs, unsigned numinputs, 1605f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IdentifierInfo **names, StringLiteral **constraints, Expr **exprs, 1606f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral *asmstr, unsigned numclobbers, 1607f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral **clobbers, SourceLocation rparenloc); 1608f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1609f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty inline-assembly statement. 1610f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit GCCAsmStmt(EmptyShell Empty) : AsmStmt(GCCAsmStmtClass, Empty), 1611f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Constraints(nullptr), Clobbers(nullptr), Names(nullptr) { } 1612f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1613f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getRParenLoc() const { return RParenLoc; } 1614f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setRParenLoc(SourceLocation L) { RParenLoc = L; } 1615f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1616f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Asm String Analysis ---===// 1617f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1618f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const StringLiteral *getAsmString() const { return AsmStr; } 1619f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral *getAsmString() { return AsmStr; } 1620f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setAsmString(StringLiteral *E) { AsmStr = E; } 1621f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1622f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// AsmStringPiece - this is part of a decomposed asm string specification 1623f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// (for use with the AnalyzeAsmString function below). An asm string is 1624f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// considered to be a concatenation of these parts. 1625f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class AsmStringPiece { 1626f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot public: 1627f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum Kind { 1628f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot String, // String in .ll asm string form, "$" -> "$$" and "%%" -> "%". 1629f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Operand // Operand reference, with optional modifier %c4. 1630f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 1631f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot private: 1632f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Kind MyKind; 1633f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot std::string Str; 1634f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned OperandNo; 1635f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1636f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Source range for operand references. 1637f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CharSourceRange Range; 1638f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot public: 1639f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot AsmStringPiece(const std::string &S) : MyKind(String), Str(S) {} 1640f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin, 1641f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation End) 1642f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : MyKind(Operand), Str(S), OperandNo(OpNo), 1643f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Range(CharSourceRange::getCharRange(Begin, End)) { 1644f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1645f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1646f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isString() const { return MyKind == String; } 1647f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isOperand() const { return MyKind == Operand; } 1648f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1649f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const std::string &getString() const { 1650f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Str; 1651f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1652f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1653f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned getOperandNo() const { 1654f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot assert(isOperand()); 1655f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return OperandNo; 1656f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1657f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1658f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CharSourceRange getRange() const { 1659f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot assert(isOperand() && "Range is currently used only for Operands."); 1660f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Range; 1661f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1662f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1663f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// getModifier - Get the modifier for this operand, if present. This 1664f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// returns '\0' if there was no modifier. 1665f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot char getModifier() const; 1666f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 1667f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1668f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// AnalyzeAsmString - Analyze the asm string of the current asm, decomposing 1669f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// it into pieces. If the asm string is erroneous, emit errors and return 1670f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// true, otherwise return false. This handles canonicalization and 1671f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// translation of strings from GCC syntax to LLVM IR syntax, and handles 1672f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //// flattening of named references like %[foo] to Operand AsmStringPiece's. 1673f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned AnalyzeAsmString(SmallVectorImpl<AsmStringPiece> &Pieces, 1674f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const ASTContext &C, unsigned &DiagOffs) const; 1675f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1676f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Assemble final IR asm string. 1677f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot std::string generateAsmString(const ASTContext &C) const; 1678f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1679f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Output operands ---===// 1680f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1681f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IdentifierInfo *getOutputIdentifier(unsigned i) const { 1682f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Names[i]; 1683f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1684f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1685f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getOutputName(unsigned i) const { 1686f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot if (IdentifierInfo *II = getOutputIdentifier(i)) 1687f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return II->getName(); 1688f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1689f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return StringRef(); 1690f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1691f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1692f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getOutputConstraint(unsigned i) const; 1693f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1694f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const StringLiteral *getOutputConstraintLiteral(unsigned i) const { 1695f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Constraints[i]; 1696f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1697f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral *getOutputConstraintLiteral(unsigned i) { 1698f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Constraints[i]; 1699f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1700f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1701f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getOutputExpr(unsigned i); 1702f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1703f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getOutputExpr(unsigned i) const { 1704f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_cast<GCCAsmStmt*>(this)->getOutputExpr(i); 1705f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1706f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1707f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Input operands ---===// 1708f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1709f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IdentifierInfo *getInputIdentifier(unsigned i) const { 1710f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Names[i + NumOutputs]; 1711f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1712f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1713f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getInputName(unsigned i) const { 1714f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot if (IdentifierInfo *II = getInputIdentifier(i)) 1715f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return II->getName(); 1716f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1717f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return StringRef(); 1718f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1719f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1720f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getInputConstraint(unsigned i) const; 1721f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1722f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const StringLiteral *getInputConstraintLiteral(unsigned i) const { 1723f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Constraints[i + NumOutputs]; 1724f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1725f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral *getInputConstraintLiteral(unsigned i) { 1726f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Constraints[i + NumOutputs]; 1727f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1728f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1729f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getInputExpr(unsigned i); 1730f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setInputExpr(unsigned i, Expr *E); 1731f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1732f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getInputExpr(unsigned i) const { 1733f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_cast<GCCAsmStmt*>(this)->getInputExpr(i); 1734f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1735f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1736f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprivate: 1737f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setOutputsAndInputsAndClobbers(const ASTContext &C, 1738f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot IdentifierInfo **Names, 1739f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral **Constraints, 1740f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt **Exprs, 1741f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumOutputs, 1742f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumInputs, 1743f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral **Clobbers, 1744f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumClobbers); 1745f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1746f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1747f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Other ---===// 1748f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1749f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// getNamedOperand - Given a symbolic operand reference like %[foo], 1750f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// translate this into a numeric value needed to reference the same operand. 1751f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// This returns -1 if the operand name is invalid. 1752f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot int getNamedOperand(StringRef SymbolicName) const; 1753f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1754f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getClobber(unsigned i) const; 1755f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringLiteral *getClobberStringLiteral(unsigned i) { return Clobbers[i]; } 1756f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const StringLiteral *getClobberStringLiteral(unsigned i) const { 1757f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Clobbers[i]; 1758f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1759f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1760f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return AsmLoc; } 1761f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; } 1762f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1763f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1764f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == GCCAsmStmtClass; 1765f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1766f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1767f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1768f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// This represents a Microsoft inline-assembly statement extension. 1769f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1770f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass MSAsmStmt : public AsmStmt { 1771f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation LBraceLoc, EndLoc; 1772f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef AsmStr; 1773f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1774f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumAsmToks; 1775f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1776f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Token *AsmToks; 1777f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef *Constraints; 1778f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef *Clobbers; 1779f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1780f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 1781f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1782f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1783f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot MSAsmStmt(const ASTContext &C, SourceLocation asmloc, 1784f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation lbraceloc, bool issimple, bool isvolatile, 1785f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<Token> asmtoks, unsigned numoutputs, unsigned numinputs, 1786f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<StringRef> constraints, 1787f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<Expr*> exprs, StringRef asmstr, 1788f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<StringRef> clobbers, SourceLocation endloc); 1789f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1790f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty MS-style inline-assembly statement. 1791f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit MSAsmStmt(EmptyShell Empty) : AsmStmt(MSAsmStmtClass, Empty), 1792f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot NumAsmToks(0), AsmToks(nullptr), Constraints(nullptr), Clobbers(nullptr) { } 1793f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1794f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLBraceLoc() const { return LBraceLoc; } 1795f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setLBraceLoc(SourceLocation L) { LBraceLoc = L; } 1796f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getEndLoc() const { return EndLoc; } 1797f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setEndLoc(SourceLocation L) { EndLoc = L; } 1798f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1799f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool hasBraces() const { return LBraceLoc.isValid(); } 1800f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1801f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned getNumAsmToks() { return NumAsmToks; } 1802f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Token *getAsmToks() { return AsmToks; } 1803f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1804f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Asm String Analysis ---===// 1805f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getAsmString() const { return AsmStr; } 1806f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1807f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Assemble final IR asm string. 1808f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot std::string generateAsmString(const ASTContext &C) const; 1809f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1810f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Output operands ---===// 1811f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1812f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getOutputConstraint(unsigned i) const { 1813f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot assert(i < NumOutputs); 1814f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Constraints[i]; 1815f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1816f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1817f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getOutputExpr(unsigned i); 1818f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1819f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getOutputExpr(unsigned i) const { 1820f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_cast<MSAsmStmt*>(this)->getOutputExpr(i); 1821f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1822f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1823f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Input operands ---===// 1824f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1825f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getInputConstraint(unsigned i) const { 1826f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot assert(i < NumInputs); 1827f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return Constraints[i + NumOutputs]; 1828f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1829f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1830f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getInputExpr(unsigned i); 1831f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setInputExpr(unsigned i, Expr *E); 1832f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1833f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Expr *getInputExpr(unsigned i) const { 1834f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_cast<MSAsmStmt*>(this)->getInputExpr(i); 1835f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1836f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1837f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot //===--- Other ---===// 1838f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1839f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<StringRef> getAllConstraints() const { 1840f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return llvm::makeArrayRef(Constraints, NumInputs + NumOutputs); 1841f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1842f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<StringRef> getClobbers() const { 1843f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return llvm::makeArrayRef(Clobbers, NumClobbers); 1844f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1845f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<Expr*> getAllExprs() const { 1846f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return llvm::makeArrayRef(reinterpret_cast<Expr**>(Exprs), 1847f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot NumInputs + NumOutputs); 1848f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1849f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1850f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot StringRef getClobber(unsigned i) const { return getClobbers()[i]; } 1851f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1852f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprivate: 1853f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void initialize(const ASTContext &C, StringRef AsmString, 1854f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<Token> AsmToks, ArrayRef<StringRef> Constraints, 1855f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<Expr*> Exprs, ArrayRef<StringRef> Clobbers); 1856f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1857f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1858f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return AsmLoc; } 1859f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return EndLoc; } 1860f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1861f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1862f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == MSAsmStmtClass; 1863f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1864f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1865f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1866f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(&Exprs[0], &Exprs[NumInputs + NumOutputs]); 1867f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1868f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1869f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1870f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass SEHExceptStmt : public Stmt { 1871f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation Loc; 1872f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *Children[2]; 1873f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1874f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum { FILTER_EXPR, BLOCK }; 1875f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1876f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SEHExceptStmt(SourceLocation Loc, 1877f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *FilterExpr, 1878f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *Block); 1879f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1880f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTReader; 1881f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 1882f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit SEHExceptStmt(EmptyShell E) : Stmt(SEHExceptStmtClass, E) { } 1883f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1884f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1885f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static SEHExceptStmt* Create(const ASTContext &C, 1886f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation ExceptLoc, 1887f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *FilterExpr, 1888f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *Block); 1889f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1890f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return getExceptLoc(); } 1891f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } 1892f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1893f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getExceptLoc() const { return Loc; } 1894f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getEndLoc() const { return getBlock()->getLocEnd(); } 1895f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1896f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Expr *getFilterExpr() const { 1897f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<Expr*>(Children[FILTER_EXPR]); 1898f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1899f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1900f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CompoundStmt *getBlock() const { 1901f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return cast<CompoundStmt>(Children[BLOCK]); 1902f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1903f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1904f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1905f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(Children,Children+2); 1906f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1907f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1908f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1909f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == SEHExceptStmtClass; 1910f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1911f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1912f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1913f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1914f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass SEHFinallyStmt : public Stmt { 1915f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation Loc; 1916f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *Block; 1917f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1918f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SEHFinallyStmt(SourceLocation Loc, 1919f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *Block); 1920f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1921f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTReader; 1922f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 1923f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit SEHFinallyStmt(EmptyShell E) : Stmt(SEHFinallyStmtClass, E) { } 1924f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1925f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1926f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static SEHFinallyStmt* Create(const ASTContext &C, 1927f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation FinallyLoc, 1928f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *Block); 1929f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1930f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return getFinallyLoc(); } 1931f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } 1932f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1933f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getFinallyLoc() const { return Loc; } 1934f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getEndLoc() const { return Block->getLocEnd(); } 1935f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1936f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CompoundStmt *getBlock() const { return cast<CompoundStmt>(Block); } 1937f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1938f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1939f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(&Block,&Block+1); 1940f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1941f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1942f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1943f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == SEHFinallyStmtClass; 1944f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1945f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1946f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1947f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1948f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass SEHTryStmt : public Stmt { 1949f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool IsCXXTry; 1950f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation TryLoc; 1951f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *Children[2]; 1952f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1953f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum { TRY = 0, HANDLER = 1 }; 1954f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1955f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SEHTryStmt(bool isCXXTry, // true if 'try' otherwise '__try' 1956f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation TryLoc, 1957f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *TryBlock, 1958f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *Handler); 1959f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1960f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTReader; 1961f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 1962f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) { } 1963f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1964f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 1965f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static SEHTryStmt* Create(const ASTContext &C, bool isCXXTry, 1966f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation TryLoc, Stmt *TryBlock, 1967f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *Handler); 1968f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1969f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); } 1970f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } 1971f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1972f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getTryLoc() const { return TryLoc; } 1973f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getEndLoc() const { return Children[HANDLER]->getLocEnd(); } 1974f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1975f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool getIsCXXTry() const { return IsCXXTry; } 1976f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1977f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CompoundStmt* getTryBlock() const { 1978f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return cast<CompoundStmt>(Children[TRY]); 1979f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1980f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1981f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getHandler() const { return Children[HANDLER]; } 1982f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1983f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Returns 0 if not defined 1984f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SEHExceptStmt *getExceptHandler() const; 1985f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SEHFinallyStmt *getFinallyHandler() const; 1986f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1987f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 1988f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(Children,Children+2); 1989f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1990f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1991f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 1992f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == SEHTryStmtClass; 1993f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 1994f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 1995f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 1996f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// Represents a __leave statement. 1997f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 1998f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass SEHLeaveStmt : public Stmt { 1999f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation LeaveLoc; 2000f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 2001f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit SEHLeaveStmt(SourceLocation LL) 2002f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {} 2003f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2004f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Build an empty __leave statement. 2005f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot explicit SEHLeaveStmt(EmptyShell Empty) : Stmt(SEHLeaveStmtClass, Empty) { } 2006f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2007f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLeaveLoc() const { return LeaveLoc; } 2008f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setLeaveLoc(SourceLocation L) { LeaveLoc = L; } 2009f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2010f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { return LeaveLoc; } 2011f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { return LeaveLoc; } 2012f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2013f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 2014f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == SEHLeaveStmtClass; 2015f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2016f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2017f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // Iterators 2018f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children() { 2019f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return child_range(child_iterator(), child_iterator()); 2020f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2021f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 2022f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2023f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// \brief This captures a statement into a function. For example, the following 2024f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// pragma annotated compound statement can be represented as a CapturedStmt, 2025f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// and this compound statement is the body of an anonymous outlined function. 2026f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// @code 2027f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// #pragma omp parallel 2028f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// { 2029f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// compute(); 2030f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// } 2031f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// @endcode 2032f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass CapturedStmt : public Stmt { 2033f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 2034f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief The different capture forms: by 'this', by reference, capture for 2035f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// variable-length array type etc. 2036f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot enum VariableCaptureKind { 2037f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VCK_This, 2038f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VCK_ByRef, 2039f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VCK_ByCopy, 2040f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VCK_VLAType, 2041f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 2042f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2043f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Describes the capture of either a variable, or 'this', or 2044f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// variable-length array type. 2045f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class Capture { 2046f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind; 2047f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation Loc; 2048f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2049f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot public: 2050f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Create a new capture. 2051f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 2052f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param Loc The source location associated with this capture. 2053f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 2054f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param Kind The kind of capture (this, ByRef, ...). 2055f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 2056f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param Var The variable being captured, or null if capturing this. 2057f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 2058f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Capture(SourceLocation Loc, VariableCaptureKind Kind, 2059f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VarDecl *Var = nullptr); 2060f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2061f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Determine the kind of capture. 2062f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VariableCaptureKind getCaptureKind() const; 2063f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2064f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the source location at which the variable or 'this' was 2065f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// first used. 2066f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocation() const { return Loc; } 2067f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2068f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Determine whether this capture handles the C++ 'this' pointer. 2069f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool capturesThis() const { return getCaptureKind() == VCK_This; } 2070f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2071f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Determine whether this capture handles a variable (by reference). 2072f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool capturesVariable() const { return getCaptureKind() == VCK_ByRef; } 2073f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2074f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Determine whether this capture handles a variable by copy. 2075f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool capturesVariableByCopy() const { 2076f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return getCaptureKind() == VCK_ByCopy; 2077f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2078f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2079f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Determine whether this capture handles a variable-length array 2080f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// type. 2081f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool capturesVariableArrayType() const { 2082f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return getCaptureKind() == VCK_VLAType; 2083f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2084f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2085f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the declaration of the variable being captured. 2086f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 2087f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// This operation is only valid if this capture captures a variable. 2088f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot VarDecl *getCapturedVar() const; 2089f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2090f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 2091f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot }; 2092f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2093f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprivate: 2094f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief The number of variable captured, including 'this'. 2095f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumCaptures; 2096f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2097f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief The pointer part is the implicit the outlined function and the 2098f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// int part is the captured region kind, 'CR_Default' etc. 2099f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot llvm::PointerIntPair<CapturedDecl *, 1, CapturedRegionKind> CapDeclAndKind; 2100f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2101f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief The record for captured variables, a RecordDecl or CXXRecordDecl. 2102f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot RecordDecl *TheRecordDecl; 2103f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2104f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Construct a captured statement. 2105f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CapturedStmt(Stmt *S, CapturedRegionKind Kind, ArrayRef<Capture> Captures, 2106f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<Expr *> CaptureInits, CapturedDecl *CD, RecordDecl *RD); 2107f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2108f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Construct an empty captured statement. 2109f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CapturedStmt(EmptyShell Empty, unsigned NumCaptures); 2110f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2111f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt **getStoredStmts() { return reinterpret_cast<Stmt **>(this + 1); } 2112f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2113f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *const *getStoredStmts() const { 2114f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<Stmt *const *>(this + 1); 2115f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2116f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2117f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Capture *getStoredCaptures() const; 2118f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2119f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setCapturedStmt(Stmt *S) { getStoredStmts()[NumCaptures] = S; } 2120f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2121f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 2122f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static CapturedStmt *Create(const ASTContext &Context, Stmt *S, 2123f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CapturedRegionKind Kind, 2124f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<Capture> Captures, 2125f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ArrayRef<Expr *> CaptureInits, 2126f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CapturedDecl *CD, RecordDecl *RD); 2127f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2128f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static CapturedStmt *CreateDeserialized(const ASTContext &Context, 2129f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumCaptures); 2130f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2131f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the statement being captured. 2132f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Stmt *getCapturedStmt() { return getStoredStmts()[NumCaptures]; } 2133f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Stmt *getCapturedStmt() const { return getStoredStmts()[NumCaptures]; } 2134f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2135f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the outlined function declaration. 2136f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CapturedDecl *getCapturedDecl(); 2137f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const CapturedDecl *getCapturedDecl() const; 2138f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2139f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Set the outlined function declaration. 2140f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setCapturedDecl(CapturedDecl *D); 2141f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2142f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the captured region kind. 2143f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot CapturedRegionKind getCapturedRegionKind() const; 2144f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2145f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Set the captured region kind. 2146f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setCapturedRegionKind(CapturedRegionKind Kind); 2147f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2148f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the record declaration for captured variables. 2149f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const RecordDecl *getCapturedRecordDecl() const { return TheRecordDecl; } 2150f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2151f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Set the record declaration for captured variables. 2152f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void setCapturedRecordDecl(RecordDecl *D) { 2153f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot assert(D && "null RecordDecl"); 2154f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot TheRecordDecl = D; 2155f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2156f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2157f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief True if this variable has been captured. 2158f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool capturesVariable(const VarDecl *Var) const; 2159f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2160f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief An iterator that walks over the captures. 2161f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef Capture *capture_iterator; 2162f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef const Capture *const_capture_iterator; 2163f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<capture_iterator> capture_range; 2164f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<const_capture_iterator> capture_const_range; 2165f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2166f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot capture_range captures() { 2167f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return capture_range(capture_begin(), capture_end()); 2168f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2169f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot capture_const_range captures() const { 2170f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return capture_const_range(capture_begin(), capture_end()); 2171f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2172f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2173f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve an iterator pointing to the first capture. 2174f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot capture_iterator capture_begin() { return getStoredCaptures(); } 2175f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_capture_iterator capture_begin() const { return getStoredCaptures(); } 2176f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2177f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve an iterator pointing past the end of the sequence of 2178f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// captures. 2179f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot capture_iterator capture_end() const { 2180f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return getStoredCaptures() + NumCaptures; 2181f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2182f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2183f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the number of captures, including 'this'. 2184f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned capture_size() const { return NumCaptures; } 2185f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2186f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Iterator that walks over the capture initialization arguments. 2187f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef Expr **capture_init_iterator; 2188f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<capture_init_iterator> capture_init_range; 2189f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2190f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Const iterator that walks over the capture initialization 2191f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// arguments. 2192f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef Expr *const *const_capture_init_iterator; 2193f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot typedef llvm::iterator_range<const_capture_init_iterator> 2194f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_capture_init_range; 2195f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2196f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot capture_init_range capture_inits() { 2197f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return capture_init_range(capture_init_begin(), capture_init_end()); 2198f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2199f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2200f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_capture_init_range capture_inits() const { 2201f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return const_capture_init_range(capture_init_begin(), capture_init_end()); 2202f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2203f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2204f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the first initialization argument. 2205f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot capture_init_iterator capture_init_begin() { 2206f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<Expr **>(getStoredStmts()); 2207f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2208f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2209f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_capture_init_iterator capture_init_begin() const { 2210f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return reinterpret_cast<Expr *const *>(getStoredStmts()); 2211f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2212f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2213f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Retrieve the iterator pointing one past the last initialization 2214f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// argument. 2215f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot capture_init_iterator capture_init_end() { 2216f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return capture_init_begin() + NumCaptures; 2217f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2218f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2219f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const_capture_init_iterator capture_init_end() const { 2220f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return capture_init_begin() + NumCaptures; 2221f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2222f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2223f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocStart() const LLVM_READONLY { 2224f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return getCapturedStmt()->getLocStart(); 2225f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2226f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getLocEnd() const LLVM_READONLY { 2227f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return getCapturedStmt()->getLocEnd(); 2228f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2229f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceRange getSourceRange() const LLVM_READONLY { 2230f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return getCapturedStmt()->getSourceRange(); 2231f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2232f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2233f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot static bool classof(const Stmt *T) { 2234f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return T->getStmtClass() == CapturedStmtClass; 2235f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 2236f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2237f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot child_range children(); 2238f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2239f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class ASTStmtReader; 2240f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 2241f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2242f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot} // end namespace clang 2243f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 2244f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#endif 2245