Skip to content

[lldb] Fix TestClangASTContext.TestFunctionTemplateInRecordConstructi… #746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lldb/unittests/Symbol/TestTypeSystemClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ TEST_F(TestTypeSystemClang, TestFunctionTemplateInRecordConstruction) {
// Tests creating a function template inside a record.

CompilerType int_type = m_ast->GetBasicType(lldb::eBasicTypeInt);
clang::TranslationUnitDecl *TU = m_ast->GetTranslationUnitDecl();

// Create a record we can put the function template int.
CompilerType record_type =
Expand All @@ -507,8 +508,11 @@ TEST_F(TestTypeSystemClang, TestFunctionTemplateInRecordConstruction) {
// Prepare the declarations/types we need for the template.
CompilerType clang_type =
m_ast->CreateFunctionType(int_type, nullptr, 0U, false, 0U);
// We create the FunctionDecl for the template in the TU DeclContext because:
// 1. FunctionDecls can't be in a Record (only CXXMethodDecls can).
// 2. It is mirroring the behavior of DWARFASTParserClang::ParseSubroutine.
FunctionDecl *func =
m_ast->CreateFunctionDeclaration(record, "foo", clang_type, 0, false);
m_ast->CreateFunctionDeclaration(TU, "foo", clang_type, 0, false);
TypeSystemClang::TemplateParameterInfos empty_params;

// Create the actual function template.
Expand Down