Fix ClangASTContext::CreateParameterDeclaration to not call addDecl
authorShafik Yaghmour <syaghmour@apple.com>
Fri, 2 Aug 2019 21:41:50 +0000 (21:41 +0000)
committerShafik Yaghmour <syaghmour@apple.com>
Fri, 2 Aug 2019 21:41:50 +0000 (21:41 +0000)
commitfa5c340ea12e5f5b217246767190d32ccb7df54a
tree9795f3b72e048f8799945a5a911d1316da7ccb80
parentd021617bf7e1a34ac8f8d25146bea1af97580e3b
Fix ClangASTContext::CreateParameterDeclaration to not call addDecl

Summary:
The change https://reviews.llvm.org/D55575 modified ClangASTContext::CreateParameterDeclaration to call decl_ctx->addDecl(decl); this caused a regression since the existing code in DWARFASTParserClang::ParseChildParameters is called with the containing DeclContext. So when end up with cases where we are parsing a parameter for a member function and the parameter is added to the CXXRecordDecl as opposed to the CXXMethodDecl. This example is given in the regression test TestBreakpointInMemberFuncWNonPrimitiveParams.py which without this fix in a modules build leads to assert on setting a breakpoint in a member function with non primitive parameters. This scenario would be common when debugging LLDB or clang.

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

llvm-svn: 367726
lldb/include/lldb/Symbol/ClangASTContext.h
lldb/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/Makefile [new file with mode: 0644]
lldb/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py [new file with mode: 0644]
lldb/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/a.cpp [new file with mode: 0644]
lldb/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/a.h [new file with mode: 0644]
lldb/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/main.cpp [new file with mode: 0644]
lldb/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/module.modulemap [new file with mode: 0644]
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/source/Symbol/ClangASTContext.cpp