================
@@ -18,11 +18,66 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Format/Format.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Regex.h"
 
 namespace clang {
 namespace format {
 
+namespace {
+
+CommentKind classifyBlockComment(StringRef Text) {
+  if (!Text.starts_with("/*") || !Text.ends_with("*/"))
----------------
Men-cotton wrote:

Thanks for pointing that out!

In the previous revision I still called `classifyBlockComment` before checking 
`isWellFormedBlockCommentText`, so line comments such as `//x` slipped through 
and would have hit the `drop_front(2).drop_back(2)` path, triggering an 
assertion. I’ve now moved the call so it only runs after 
`isWellFormedBlockCommentText` succeeds, which guarantees we only classify 
well-formed block comments. With that change the guard inside 
`classifyBlockComment` can’t fire anymore, so I removed it in the latest patch.

https://github.com/llvm/llvm-project/pull/162105
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to