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,
171
171
SourceLoc getStartLoc () const ;
172
172
SourceLoc getEndLoc () const ;
173
173
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
+
174
181
bool empty () const { return getNumElements () == 0 ; }
175
182
unsigned getNumElements () const { return Bits.BraceStmt .NumElements ; }
176
183
Original file line number Diff line number Diff line change @@ -160,6 +160,17 @@ SourceLoc BraceStmt::getStartLoc() const {
160
160
if (LBLoc) {
161
161
return LBLoc;
162
162
}
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 {
163
174
for (auto elt : getElements ()) {
164
175
if (auto loc = elt.getStartLoc ()) {
165
176
return loc;
@@ -168,10 +179,7 @@ SourceLoc BraceStmt::getStartLoc() const {
168
179
return SourceLoc ();
169
180
}
170
181
171
- SourceLoc BraceStmt::getEndLoc () const {
172
- if (RBLoc) {
173
- return RBLoc;
174
- }
182
+ SourceLoc BraceStmt::getContentEndLoc () const {
175
183
for (auto elt : llvm::reverse (getElements ())) {
176
184
if (auto loc = elt.getEndLoc ()) {
177
185
return loc;
You can’t perform that action at this time.
0 commit comments