[clang] [clang-format] Fix requires misannotation with comma (PR #65908)

Emilia Kond via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 10 13:03:42 PDT 2023


================
@@ -3369,9 +3369,13 @@ bool clang::format::UnwrappedLineParser::parseRequires() {
     case tok::kw_volatile:
     case tok::kw_const:
     case tok::comma:
-      FormatTok = Tokens->setPosition(StoredPosition);
-      parseRequiresExpression(RequiresToken);
-      return false;
+      if (OpenAngles == 0) {
+        FormatTok = Tokens->setPosition(StoredPosition);
+        parseRequiresExpression(RequiresToken);
+        return false;
+      } else {
+        break;
+      }
----------------
rymiel wrote:


I realized after that i could do this. Would this be preferred?
```suggestion
      if (OpenAngles != 0)
        break;
      FormatTok = Tokens->setPosition(StoredPosition);
      parseRequiresExpression(RequiresToken);
      return false;
```


https://github.com/llvm/llvm-project/pull/65908


More information about the cfe-commits mailing list