[ast] CreateParameterDeclaration should use an appropriate DeclContext.
authorZachary Turner <zturner@google.com>
Wed, 12 Dec 2018 17:17:53 +0000 (17:17 +0000)
committerZachary Turner <zturner@google.com>
Wed, 12 Dec 2018 17:17:53 +0000 (17:17 +0000)
commit6753d2d1803b89cfe1f86631a79c4c435c04af8d
tree77edc8563191c6dabaa9c8ed486b38e9b3ff15e0
parent7da5a08e1a50ca5da1a35a4fa83673bf96f37d3c
[ast] CreateParameterDeclaration should use an appropriate DeclContext.

Previously CreateParameterDeclaration was always using the translation
unit DeclContext.  We would later go and add parameters to the
FunctionDecl, but internally clang makes a copy when you do this, and
we'd end up with ParmVarDecl's at the global scope as well as in the
function scope.

This fixes the issue.  It's hard to say whether this will introduce
a behavioral change in name lookup, but I know there have been several
hacks introduced in previous years to deal with collisions between
various types of variables, so there's a chance that this patch could
obviate one of those hacks.

Differential Revision: https://reviews.llvm.org/D55571

llvm-svn: 348941
lldb/include/lldb/Symbol/ClangASTContext.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/source/Symbol/ClangASTContext.cpp