MyDeveloperDay added a comment.

That works because the argument list is just tok::identifier and TT_StartOfName

so if we see StartOfName we are going to return true

identifier will simply be skipped round the loop

``
int
Test(A a)
{}

  

AnnotatedTokens(L=0):
 M=0 C=0 T=Unknown S=1 B=0 BK=0 P=0 Name=int L=3 PPK=2 FakeLParens= 
FakeRParens=0 II=0x11be8c48b20 Text='int'
 M=1 C=1 T=FunctionDeclarationName S=1 B=0 BK=0 P=220 Name=identifier L=88 
PPK=2 FakeLParens= FakeRParens=0 II=0x11be8c42d00 Text='Test'
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=23 Name=l_paren L=89 PPK=2 FakeLParens= 
FakeRParens=0 II=0x0 Text='('
 M=0 C=1 T=Unknown S=0 B=0 BK=0 P=140 Name=identifier L=90 PPK=2 FakeLParens= 
FakeRParens=0 II=0x11be8c42c70 Text='A'
 M=0 C=1 T=StartOfName S=1 B=0 BK=0 P=240 Name=identifier L=92 PPK=2 
FakeLParens= FakeRParens=0 II=0x11be8c42ca0 Text='a'
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=43 Name=r_paren L=93 PPK=2 FakeLParens= 
FakeRParens=0 II=0x0 Text=')'

  Where you are correct in its handling is this, because it doesn't see the 
TT_StartOfName it doesn't return true and so falls out the bottom of the 
function with false
  and hence doesn't break the return type
  
  int Test(A) {}

AnnotatedTokens(L=0):
 M=0 C=0 T=Unknown S=1 B=0 BK=0 P=0 Name=int L=3 PPK=2 FakeLParens= 
FakeRParens=0 II=0x245bb8e7140 Text='int'
 M=0 C=1 T=StartOfName S=1 B=0 BK=0 P=220 Name=identifier L=8 PPK=2 
FakeLParens= FakeRParens=0 II=0x245bb8ebdc0 Text='Test'
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=23 Name=l_paren L=9 PPK=2 FakeLParens= 
FakeRParens=0 II=0x0 Text='('
 M=0 C=1 T=Unknown S=0 B=0 BK=0 P=140 Name=identifier L=10 PPK=2 FakeLParens= 
FakeRParens=0 II=0x245bb8ebd30 Text='A'
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=43 Name=r_paren L=11 PPK=2 FakeLParens= 
FakeRParens=0 II=0x0 Text=')'

  


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

https://reviews.llvm.org/D59309



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to