[PATCH] D148029: [Clang] Fix crash caused by line splicing in doc comment

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 11 12:36:58 PDT 2023


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

The changes seem reasonable to me.



================
Comment at: clang/include/clang/AST/RawCommentList.h:122
+    StringRef Text = getRawText(SourceMgr);
+    if (Text.size() < 6 || Text[0] != '/')
+      return false;
----------------
cor3ntin wrote:
> aaron.ballman wrote:
> > Just to double-check, we don't have to worry about there being leading whitespace in `Text` do we?
> Afaict, we always have a valid comment, starting with / (and ending with / for a multi line comment). We might not have a comment valid for documentation purposes.
Excellent -- I was poking around and it seemed like we do trim the text before forming the comment object, so yay.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148029/new/

https://reviews.llvm.org/D148029



More information about the cfe-commits mailing list