summaryrefslogtreecommitdiff
path: root/lldb/source/Symbol/ClangASTContext.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-12-12 17:17:53 +0000
committerZachary Turner <zturner@google.com>2018-12-12 17:17:53 +0000
commitdb72ed6c2b8f1b5b07ba20cb324196a13c07baa4 (patch)
treef67ddecea05c2e67eb83a938780b5cd679da1fb7 /lldb/source/Symbol/ClangASTContext.cpp
parent58f7c3e95fa8b8efcd0c0fde707740d8cb7efd36 (diff)
[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
Diffstat (limited to 'lldb/source/Symbol/ClangASTContext.cpp')
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index f13631076b4..7dd8aecc733 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -2214,11 +2214,11 @@ CompilerType ClangASTContext::CreateFunctionType(
}
ParmVarDecl *ClangASTContext::CreateParameterDeclaration(
- const char *name, const CompilerType &param_type, int storage) {
+ clang::DeclContext *decl_ctx, const char *name,
+ const CompilerType &param_type, int storage) {
ASTContext *ast = getASTContext();
assert(ast != nullptr);
- return ParmVarDecl::Create(*ast, ast->getTranslationUnitDecl(),
- SourceLocation(), SourceLocation(),
+ return ParmVarDecl::Create(*ast, decl_ctx, SourceLocation(), SourceLocation(),
name && name[0] ? &ast->Idents.get(name) : nullptr,
ClangUtil::GetQualType(param_type), nullptr,
(clang::StorageClass)storage, nullptr);