Skip to content

Commit 84dd803

Browse files
committed
Small fix to par heading check and comments
1 parent 43ed3b9 commit 84dd803

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

clang/lib/AST/CommentParser.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,19 @@ class TextTokenRetokenizer {
149149
addToken();
150150
}
151151

152-
/// Check if this line starts with @par or \par
152+
// Check if this line starts with @par or \par
153153
bool startsWithParCommand() {
154154
unsigned Offset = 1;
155155

156-
/// Skip all whitespace characters at the beginning.
157-
/// This needs to backtrack because Pos has already advanced past the
158-
/// actual \par or @par command by the time this function is called.
156+
// Skip all whitespace characters at the beginning.
157+
// This needs to backtrack because Pos has already advanced past the
158+
// actual \par or @par command by the time this function is called.
159159
while (isWhitespace(*(Pos.BufferPtr - Offset)))
160160
Offset++;
161161

162-
/// Check if next four characters are \par or @par
163-
llvm::StringRef LineStart(Pos.BufferPtr - 5, 4);
162+
// Once we've reached the whitespace, backtrack and check if the previous four
163+
// characters are \par or @par.
164+
llvm::StringRef LineStart(Pos.BufferPtr - Offset - 3, 4);
164165
return LineStart.starts_with("\\par") || LineStart.starts_with("@par");
165166
}
166167

@@ -180,7 +181,7 @@ class TextTokenRetokenizer {
180181
return false;
181182

182183
// Read until the end of this token, which is effectively the end of the
183-
// line This gets us the content of the par header, if there is one.
184+
// line. This gets us the content of the par header, if there is one.
184185
while (!isEnd()) {
185186
WordText.push_back(peek());
186187
if (Pos.BufferPtr + 1 == Pos.BufferEnd) {

0 commit comments

Comments
 (0)