[PATCH] D119138: [clang-format] Further improve support for requires expressions

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 7 08:04:50 PST 2022


curdeius added a comment.

Some nits.



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1541-1542
+    case tok::kw_requires: {
+      bool Return = parseRequires();
+      if (Return)
+        return;
----------------



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2791
+/// \pre The current token has to be the requires keyword.
+/// \returns If it parsed a clause.
+bool clang::format::UnwrappedLineParser::parseRequires() {
----------------



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2818
+    default:
+      // Is most definitly an expression.
+      return true;
----------------



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2826
+    if (!LastParenContent) {
+      // No Token is invalid code, just do whatever you want.
+      return true;
----------------



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2854
+      if (LastParenContent->isSimpleTypeSpecifier()) {
+        // Definetly function delcaration.
+        return false;
----------------



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2862
+    if (!BeforeLastParenContent) {
+      // No Token is invalid code, just do whatever you want.
+      return true;
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119138



More information about the cfe-commits mailing list