@@ -321,6 +321,7 @@ class alignas(8) PoundAvailableInfo final :
321
321
friend TrailingObjects;
322
322
323
323
SourceLoc PoundLoc;
324
+ SourceLoc LParenLoc;
324
325
SourceLoc RParenLoc;
325
326
326
327
// The number of queries tail allocated after this object.
@@ -338,17 +339,18 @@ class alignas(8) PoundAvailableInfo final :
338
339
// / This is filled in by Sema.
339
340
VersionRange VariantAvailableRange;
340
341
341
- PoundAvailableInfo (SourceLoc PoundLoc, ArrayRef<AvailabilitySpec *> queries ,
342
- SourceLoc RParenLoc)
343
- : PoundLoc (PoundLoc), RParenLoc (RParenLoc ), NumQueries (queries. size () ),
344
- AvailableRange (VersionRange::empty ()),
342
+ PoundAvailableInfo (SourceLoc PoundLoc, SourceLoc LParenLoc ,
343
+ ArrayRef<AvailabilitySpec *> queries, SourceLoc RParenLoc)
344
+ : PoundLoc (PoundLoc), LParenLoc (LParenLoc ), RParenLoc (RParenLoc ),
345
+ NumQueries (queries. size ()), AvailableRange (VersionRange::empty ()),
345
346
VariantAvailableRange (VersionRange::empty ()) {
346
347
std::uninitialized_copy (queries.begin (), queries.end (),
347
348
getTrailingObjects<AvailabilitySpec *>());
348
349
}
349
350
350
351
public:
351
352
static PoundAvailableInfo *create (ASTContext &ctx, SourceLoc PoundLoc,
353
+ SourceLoc LParenLoc,
352
354
ArrayRef<AvailabilitySpec *> queries,
353
355
SourceLoc RParenLoc);
354
356
@@ -357,6 +359,9 @@ class alignas(8) PoundAvailableInfo final :
357
359
NumQueries);
358
360
}
359
361
362
+ SourceLoc getLParenLoc () const { return LParenLoc; }
363
+ SourceLoc getRParenLoc () const { return RParenLoc; }
364
+
360
365
SourceLoc getStartLoc () const { return PoundLoc; }
361
366
SourceLoc getEndLoc () const ;
362
367
SourceLoc getLoc () const { return PoundLoc; }
@@ -771,6 +776,7 @@ class WhileStmt : public LabeledConditionalStmt {
771
776
772
777
SourceLoc getStartLoc () const { return getLabelLocOrKeywordLoc (WhileLoc); }
773
778
SourceLoc getEndLoc () const { return Body->getEndLoc (); }
779
+ SourceLoc getWhileLoc () const { return WhileLoc; }
774
780
775
781
Stmt *getBody () const { return Body; }
776
782
void setBody (Stmt *s) { Body = s; }
@@ -792,9 +798,10 @@ class RepeatWhileStmt : public LabeledStmt {
792
798
getDefaultImplicitFlag (implicit, RepeatLoc),
793
799
LabelInfo),
794
800
RepeatLoc(RepeatLoc), WhileLoc(WhileLoc), Body(Body), Cond(Cond) {}
795
-
801
+
796
802
SourceLoc getStartLoc () const { return getLabelLocOrKeywordLoc (RepeatLoc); }
797
803
SourceLoc getEndLoc () const ;
804
+ SourceLoc getRepeatLoc () const { return RepeatLoc; }
798
805
799
806
Stmt *getBody () const { return Body; }
800
807
void setBody (Stmt *s) { Body = s; }
@@ -819,6 +826,7 @@ class ForEachStmt : public LabeledStmt {
819
826
Pattern *Pat;
820
827
SourceLoc InLoc;
821
828
Expr *Sequence;
829
+ SourceLoc WhereLoc;
822
830
Expr *WhereExpr = nullptr ;
823
831
BraceStmt *Body;
824
832
@@ -831,12 +839,12 @@ class ForEachStmt : public LabeledStmt {
831
839
832
840
public:
833
841
ForEachStmt (LabeledStmtInfo LabelInfo, SourceLoc ForLoc, Pattern *Pat,
834
- SourceLoc InLoc, Expr *Sequence, Expr *WhereExpr, BraceStmt *Body ,
835
- Optional<bool > implicit = None)
842
+ SourceLoc InLoc, Expr *Sequence, SourceLoc WhereLoc ,
843
+ Expr *WhereExpr, BraceStmt *Body, Optional<bool > implicit = None)
836
844
: LabeledStmt(StmtKind::ForEach, getDefaultImplicitFlag(implicit, ForLoc),
837
845
LabelInfo),
838
846
ForLoc (ForLoc), Pat(nullptr ), InLoc(InLoc), Sequence(Sequence),
839
- WhereExpr(WhereExpr), Body(Body) {
847
+ WhereLoc(WhereLoc), WhereExpr(WhereExpr), Body(Body) {
840
848
setPattern (Pat);
841
849
}
842
850
@@ -864,6 +872,9 @@ class ForEachStmt : public LabeledStmt {
864
872
865
873
// / getInLoc - Retrieve the location of the 'in' keyword.
866
874
SourceLoc getInLoc () const { return InLoc; }
875
+
876
+ // / getWhereLoc - Retrieve the location of the 'where' keyword.
877
+ SourceLoc getWhereLoc () const { return WhereLoc; }
867
878
868
879
// / getPattern - Retrieve the pattern describing the iteration variables.
869
880
// / These variables will only be visible within the body of the loop.
0 commit comments