diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2025-01-27 14:56:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-27 14:56:47 +0000 |
commit | 081723b9db84e78d7dd240b46af2aeb3b51b00be (patch) | |
tree | 1bd5a56a8b7b292703584411c5ea6b8792920b77 /llvm/lib/Transforms | |
parent | 561132e71b29d9b747dfda1509f715847852f77b (diff) | |
download | llvm-081723b9db84e78d7dd240b46af2aeb3b51b00be.zip llvm-081723b9db84e78d7dd240b46af2aeb3b51b00be.tar.gz llvm-081723b9db84e78d7dd240b46af2aeb3b51b00be.tar.bz2 |
[lldb][TypeSystem] Ensure that ParmVarDecls have the correct DeclContext (#124279)
While sifting through this part of the code I noticed that when we parse
C++ methods, `DWARFASTParserClang` creates two sets of `ParmVarDecls`,
one in `ParseChildParameters` and once in `AddMethodToCXXRecordType`.
The former is unused when we're dealing with methods. Moreover, the
`ParmVarDecls` we created in `ParseChildParameters` were created with an
incorrect `clang::DeclContext` (namely the DeclContext of the function,
and not the function itself). In Clang, there's
`ParmVarDecl::setOwningFunction` to adjust the DeclContext of a
parameter if the parameter was created before the FunctionDecl. But we
never used it.
This patch removes the `ParmVarDecl` creation from
`ParseChildParameters` and instead creates a
`TypeSystemClang::CreateParameterDeclarations` that ensures we set the
DeclContext correctly.
Note there is one differences in how `ParmVarDecl`s would be created
now: we won't set a ClangASTMetadata entry for any of the parameters. I
don't think this was ever actually useful for parameter DIEs anyway.
This wasn't causing any concrete issues (that I know of), but was quite
surprising. And this way of setting the parameters seems easier to
reason about (in my opinion).
Diffstat (limited to 'llvm/lib/Transforms')
0 files changed, 0 insertions, 0 deletions