[all-commits] [llvm/llvm-project] ac73ca: Ensure TreeTransform considers ParmVarDecls as tra...
Erich Keane via All-commits
all-commits at lists.llvm.org
Mon Oct 12 14:38:36 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: ac73cafac0e523879b42b305106cd6e67bfb412e
https://github.com/llvm/llvm-project/commit/ac73cafac0e523879b42b305106cd6e67bfb412e
Author: Erich Keane <erich.keane at intel.com>
Date: 2020-10-12 (Mon, 12 Oct 2020)
Changed paths:
M clang/lib/Sema/TreeTransform.h
A clang/test/SemaCXX/pr47804.cpp
Log Message:
-----------
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.
More information about the All-commits
mailing list