1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | #ifndef LLVM_CLANG_AST_EXPROPENMP_H |
14 | #define LLVM_CLANG_AST_EXPROPENMP_H |
15 | |
16 | #include "clang/AST/Expr.h" |
17 | |
18 | namespace clang { |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | class OMPArraySectionExpr : public Expr { |
45 | enum { BASE, LOWER_BOUND, LENGTH, END_EXPR }; |
46 | Stmt *SubExprs[END_EXPR]; |
47 | SourceLocation ColonLoc; |
48 | SourceLocation RBracketLoc; |
49 | |
50 | public: |
51 | OMPArraySectionExpr(Expr *Base, Expr *LowerBound, Expr *Length, QualType Type, |
52 | ExprValueKind VK, ExprObjectKind OK, |
53 | SourceLocation ColonLoc, SourceLocation RBracketLoc) |
54 | : Expr( |
55 | OMPArraySectionExprClass, Type, VK, OK, |
56 | Base->isTypeDependent() || |
57 | (LowerBound && LowerBound->isTypeDependent()) || |
58 | (Length && Length->isTypeDependent()), |
59 | Base->isValueDependent() || |
60 | (LowerBound && LowerBound->isValueDependent()) || |
61 | (Length && Length->isValueDependent()), |
62 | Base->isInstantiationDependent() || |
63 | (LowerBound && LowerBound->isInstantiationDependent()) || |
64 | (Length && Length->isInstantiationDependent()), |
65 | Base->containsUnexpandedParameterPack() || |
66 | (LowerBound && LowerBound->containsUnexpandedParameterPack()) || |
67 | (Length && Length->containsUnexpandedParameterPack())), |
68 | ColonLoc(ColonLoc), RBracketLoc(RBracketLoc) { |
69 | SubExprs[BASE] = Base; |
70 | SubExprs[LOWER_BOUND] = LowerBound; |
71 | SubExprs[LENGTH] = Length; |
72 | } |
73 | |
74 | |
75 | explicit OMPArraySectionExpr(EmptyShell Shell) |
76 | : Expr(OMPArraySectionExprClass, Shell) {} |
77 | |
78 | |
79 | |
80 | |
81 | Expr *getBase() { return cast<Expr>(SubExprs[BASE]); } |
82 | const Expr *getBase() const { return cast<Expr>(SubExprs[BASE]); } |
83 | |
84 | void setBase(Expr *E) { SubExprs[BASE] = E; } |
85 | |
86 | |
87 | static QualType getBaseOriginalType(const Expr *Base); |
88 | |
89 | |
90 | Expr *getLowerBound() { return cast_or_null<Expr>(SubExprs[LOWER_BOUND]); } |
91 | const Expr *getLowerBound() const { |
92 | return cast_or_null<Expr>(SubExprs[LOWER_BOUND]); |
93 | } |
94 | |
95 | void setLowerBound(Expr *E) { SubExprs[LOWER_BOUND] = E; } |
96 | |
97 | |
98 | Expr *getLength() { return cast_or_null<Expr>(SubExprs[LENGTH]); } |
99 | const Expr *getLength() const { return cast_or_null<Expr>(SubExprs[LENGTH]); } |
100 | |
101 | void setLength(Expr *E) { SubExprs[LENGTH] = E; } |
102 | |
103 | SourceLocation getBeginLoc() const LLVM_READONLY { |
104 | return getBase()->getBeginLoc(); |
105 | } |
106 | SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; } |
107 | |
108 | SourceLocation getColonLoc() const { return ColonLoc; } |
109 | void setColonLoc(SourceLocation L) { ColonLoc = L; } |
110 | |
111 | SourceLocation getRBracketLoc() const { return RBracketLoc; } |
112 | void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } |
113 | |
114 | SourceLocation getExprLoc() const LLVM_READONLY { |
115 | return getBase()->getExprLoc(); |
116 | } |
117 | |
118 | static bool classof(const Stmt *T) { |
119 | return T->getStmtClass() == OMPArraySectionExprClass; |
120 | } |
121 | |
122 | child_range children() { |
123 | return child_range(&SubExprs[BASE], &SubExprs[END_EXPR]); |
124 | } |
125 | }; |
126 | } |
127 | |
128 | #endif |
129 | |