File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,13 @@ class BraceStmt final : public Stmt,
171171 SourceLoc getStartLoc () const ;
172172 SourceLoc getEndLoc () const ;
173173
174+ SourceLoc getContentStartLoc () const ;
175+ SourceLoc getContentEndLoc () const ;
176+ // / The range of the brace statement without the braces.
177+ SourceRange getContentRange () const {
178+ return {getContentStartLoc (), getContentEndLoc ()};
179+ }
180+
174181 bool empty () const { return getNumElements () == 0 ; }
175182 unsigned getNumElements () const { return Bits.BraceStmt .NumElements ; }
176183
Original file line number Diff line number Diff line change @@ -160,6 +160,17 @@ SourceLoc BraceStmt::getStartLoc() const {
160160 if (LBLoc) {
161161 return LBLoc;
162162 }
163+ return getContentStartLoc ();
164+ }
165+
166+ SourceLoc BraceStmt::getEndLoc () const {
167+ if (RBLoc) {
168+ return RBLoc;
169+ }
170+ return getContentEndLoc ();
171+ }
172+
173+ SourceLoc BraceStmt::getContentStartLoc () const {
163174 for (auto elt : getElements ()) {
164175 if (auto loc = elt.getStartLoc ()) {
165176 return loc;
@@ -168,10 +179,7 @@ SourceLoc BraceStmt::getStartLoc() const {
168179 return SourceLoc ();
169180}
170181
171- SourceLoc BraceStmt::getEndLoc () const {
172- if (RBLoc) {
173- return RBLoc;
174- }
182+ SourceLoc BraceStmt::getContentEndLoc () const {
175183 for (auto elt : llvm::reverse (getElements ())) {
176184 if (auto loc = elt.getEndLoc ()) {
177185 return loc;
You can’t perform that action at this time.
0 commit comments