[clang] [Clang][Comments] Add argument parsing for @throw @throws @exception (PR #84726)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 27 03:30:49 PDT 2024


================
@@ -149,6 +276,93 @@ class TextTokenRetokenizer {
     addToken();
   }
 
+  /// Extract a type argument
+  bool lexType(Token &Tok) {
+    if (isEnd())
+      return false;
+    Position SavedPos = Pos;
+    consumeWhitespace();
+    SmallString<32> NextToken;
+    SmallString<32> WordText;
+    const char *WordBegin = Pos.BufferPtr;
+    SourceLocation Loc = getSourceLocation();
+    StringRef ConstVal = StringRef("const");
+    StringRef PointerVal = StringRef("*");
+    StringRef ReferenceVal = StringRef("&");
+    bool ConstPointer = false;
+
+    while (!isEnd()) {
+      const char C = peek();
+      if (!isWhitespace(C)) {
+        if (C == '<') {
+          if (!lexTemplate(WordText))
+            return false;
+        } else {
+          WordText.push_back(C);
----------------
sdkrystian wrote:

Does this treat any non-whitespace character (other than `<`) as being part of a name?

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


More information about the cfe-commits mailing list