Ensure TreeTransform considers ParmVarDecls as transformed Decls
See PR47804: TreeTransform uses TransformedLocalDecls as a map of declarations that have been transformed already. When doing a "TransformDecl", which happens in the cases of updating a DeclRefExpr's target, the default implementation simply returns the already transformed declaration. However, this was not including ParmVarDecls. SO, any use of TreeTransform that didn't re-implement TransformDecl would NOT properly update the target of a DeclRefExpr, resulting in odd behavior. In the case of Typo-recovery, the result was that a lambda that used its own parameter would cause an error, since it thought that the ParmVarDecl referenced was a different lambda. Additionally, this caused a problem in the AST (a declrefexpr into another scope) such that a future instantiation would cause an assertion. This patch ensures that the ParmVarDecl transforming process records into TransformedLocalDecls so that the DeclRefExpr is ALSO updated.
parent
46d3e428
Please register or sign in to comment