AaronBallman wrote: Thanks for working on this! It seems we're pretty inconsistent with how we handle this recovery. Sometimes we inject a token: https://github.com/llvm/llvm-project/blob/ca9ac0e24abb63281db6ec7c2d3a262984aa00f6/clang/lib/Parse/ParseDecl.cpp#L5225 https://github.com/llvm/llvm-project/blob/ca9ac0e24abb63281db6ec7c2d3a262984aa00f6/clang/lib/Parse/ParseDecl.cpp#L5525 https://github.com/llvm/llvm-project/blob/396d63813ccb4e3e9ed9e015bc236a3941630d6e/clang/lib/Parse/ParseDeclCXX.cpp#L1923 https://github.com/llvm/llvm-project/blob/396d63813ccb4e3e9ed9e015bc236a3941630d6e/clang/lib/Parse/ParseDeclCXX.cpp#L2234
Other times, we skip until we get to a real semicolon: https://github.com/llvm/llvm-project/blob/ca9ac0e24abb63281db6ec7c2d3a262984aa00f6/clang/lib/Parse/ParseCXXInlineMethods.cpp#L133 https://github.com/llvm/llvm-project/blob/9c6054d29d44133abd3c79db710f5c25f83ab831/clang/lib/Parse/ParseDeclCXX.cpp#L711 https://github.com/llvm/llvm-project/blob/9c6054d29d44133abd3c79db710f5c25f83ab831/clang/lib/Parse/ParseDeclCXX.cpp#L829 https://github.com/llvm/llvm-project/blob/9c6054d29d44133abd3c79db710f5c25f83ab831/clang/lib/Parse/ParseDeclCXX.cpp#L902 (and many other instances of each). I kind of wonder if it would make sense for us to have a recovery function that can be called consistently, and then from there we can hopefully align the preprocessor cache state with the parser state so that this kind of assertion can be retained. I'm a bit uncomfortable removing the assertion because that kind of inconsistent state is likely to cause problems elsewhere as well. https://github.com/llvm/llvm-project/pull/188123 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
