================
@@ -3632,6 +3632,36 @@ static unsigned maxNestingDepth(const AnnotatedLine
&Line) {
return Result;
}
+// Returns the token after the first qualifier of the name, or nullptr if there
+// is no qualifier.
+static FormatToken *skipNameQualifier(const FormatToken *Tok) {
+ // Qualified names must start with an identifier.
+ if (!Tok->is(tok::identifier))
+ return nullptr;
+
+ Tok = Tok->getNextNonComment();
+ if (Tok == nullptr)
+ return nullptr;
+
+ // Consider: A::B::B()
+ // Tok --^
+ if (Tok->is(tok::coloncolon))
+ return Tok->getNextNonComment();
+
+ // Consider: A<float>::B<int>::B()
+ // Tok --^
+ if (Tok->is(TT_TemplateOpener)) {
+ if (!Tok->MatchingParen)
+ return nullptr;
+
+ Tok = Tok->MatchingParen;
+ if (Tok->startsSequence(TT_TemplateCloser, tok::coloncolon))
+ return Tok->getNextNonComment()->getNextNonComment();
+ }
+
+ return nullptr;
----------------
bdunkin wrote:
This is a good simplification. I have made this change.
https://github.com/llvm/llvm-project/pull/143194
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits