[Lldb-commits] [PATCH] D72359: [lldb] Fix TestClangASTContext.TestFunctionTemplateInRecordConstruction in Debug builds

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 10 12:35:44 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9e13cff44d6b: [lldb] Fix TestClangASTContext.TestFunctionTemplateInRecordConstruction in… (authored by teemperor).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72359/new/

https://reviews.llvm.org/D72359

Files:
  lldb/unittests/Symbol/TestClangASTContext.cpp


Index: lldb/unittests/Symbol/TestClangASTContext.cpp
===================================================================
--- lldb/unittests/Symbol/TestClangASTContext.cpp
+++ lldb/unittests/Symbol/TestClangASTContext.cpp
@@ -498,6 +498,7 @@
   // 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 =
@@ -507,8 +508,11 @@
   // 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);
   ClangASTContext::TemplateParameterInfos empty_params;
 
   // Create the actual function template.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72359.237416.patch
Type: text/x-patch
Size: 1221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200110/41b37a5f/attachment.bin>


More information about the lldb-commits mailing list