[PATCH] D116186: Comment parsing: Simplify Lexer::skipLineStartingDecorations (NFC)

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 14 13:48:32 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbd0a970f5341: Comment parsing: Simplify Lexer::skipLineStartingDecorations (NFC) (authored by aaronpuchert).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116186

Files:
  clang/lib/AST/CommentLexer.cpp


Index: clang/lib/AST/CommentLexer.cpp
===================================================================
--- clang/lib/AST/CommentLexer.cpp
+++ clang/lib/AST/CommentLexer.cpp
@@ -94,31 +94,12 @@
   if (BufferPtr == CommentEnd)
     return;
 
-  switch (*BufferPtr) {
-  case ' ':
-  case '\t':
-  case '\f':
-  case '\v': {
-    const char *NewBufferPtr = BufferPtr;
-    NewBufferPtr++;
-    if (NewBufferPtr == CommentEnd)
+  const char *NewBufferPtr = BufferPtr;
+  while (isHorizontalWhitespace(*NewBufferPtr))
+    if (++NewBufferPtr == CommentEnd)
       return;
-
-    char C = *NewBufferPtr;
-    while (isHorizontalWhitespace(C)) {
-      NewBufferPtr++;
-      if (NewBufferPtr == CommentEnd)
-        return;
-      C = *NewBufferPtr;
-    }
-    if (C == '*')
-      BufferPtr = NewBufferPtr + 1;
-    break;
-  }
-  case '*':
-    BufferPtr++;
-    break;
-  }
+  if (*NewBufferPtr == '*')
+    BufferPtr = NewBufferPtr + 1;
 }
 
 namespace {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116186.400138.patch
Type: text/x-patch
Size: 957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220114/1518ea9e/attachment.bin>


More information about the cfe-commits mailing list