Skip to content

Commit 362080b

Browse files
committed
Small fix to par heading check and comments
1 parent b7f0174 commit 362080b

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
@@ -222,18 +222,19 @@ class TextTokenRetokenizer {
222222
return true;
223223
}
224224

225-
/// Check if this line starts with @par or \par
225+
// Check if this line starts with @par or \par
226226
bool startsWithParCommand() {
227227
unsigned Offset = 1;
228228

229-
/// Skip all whitespace characters at the beginning.
230-
/// This needs to backtrack because Pos has already advanced past the
231-
/// actual \par or @par command by the time this function is called.
229+
// Skip all whitespace characters at the beginning.
230+
// This needs to backtrack because Pos has already advanced past the
231+
// actual \par or @par command by the time this function is called.
232232
while (isWhitespace(*(Pos.BufferPtr - Offset)))
233233
Offset++;
234234

235-
/// Check if next four characters are \par or @par
236-
llvm::StringRef LineStart(Pos.BufferPtr - 5, 4);
235+
// Once we've reached the whitespace, backtrack and check if the previous four
236+
// characters are \par or @par.
237+
llvm::StringRef LineStart(Pos.BufferPtr - Offset - 3, 4);
237238
return LineStart.starts_with("\\par") || LineStart.starts_with("@par");
238239
}
239240

@@ -253,7 +254,7 @@ class TextTokenRetokenizer {
253254
return false;
254255

255256
// Read until the end of this token, which is effectively the end of the
256-
// line This gets us the content of the par header, if there is one.
257+
// line. This gets us the content of the par header, if there is one.
257258
while (!isEnd()) {
258259
WordText.push_back(peek());
259260
if (Pos.BufferPtr + 1 == Pos.BufferEnd) {

0 commit comments

Comments
 (0)