rsmith added a comment.

If you want to take this path, you should also add `ActOnStartOfFunctionBody` 
calls to the other parts of the parser that parse function definitions: 
`Parser::ParseLateTemplatedFuncDef`, `Parser::ParseLexedObjCMethodDefs`, and 
`Parser::ParseLexedMethodDefs`. You should also rename 
`ActOnFinishFunctionBody` to something like `ActOnFinishFunctionDef` to avoid 
confusion, because it pairs with `ActOnStartOfFunctionDef` not the new 
`ActOnStartFunctionBody`.

However, I wonder if there isn't a simpler way to handle this, rather than 
adding another function that is called almost every time that 
`ActOnStartOfFunctionDef` is called: the `Declarator` object passed to 
`ActOnStartOfFunctionDef` already carries a `FunctionDefinitionKind` which 
tells you whether the function definition has a body. You could extend the 
non-`Declarator` overload to also take a `FunctionDefinitionKind` and then 
update the callers to pass in the right value. Then in 
`ActOnStartOfFunctionDef`, only set `WillHaveBody` if the kind is 
`FDK_Definition`.


https://reviews.llvm.org/D30375



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

Reply via email to