[all-commits] [llvm/llvm-project] 9e13cf: [lldb] Fix TestClangASTContext.TestFunctionTemplat...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Fri Jan 10 12:34:26 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e13cff44d6b8b9c9c8420870132931c218707cb
      https://github.com/llvm/llvm-project/commit/9e13cff44d6b8b9c9c8420870132931c218707cb
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-01-10 (Fri, 10 Jan 2020)

  Changed paths:
    M lldb/unittests/Symbol/TestClangASTContext.cpp

  Log Message:
  -----------
  [lldb] Fix TestClangASTContext.TestFunctionTemplateInRecordConstruction in Debug builds

Summary:
In Debug builds we call VerifyDecl in ClangASTContext::CreateFunctionDeclaration which in turn
calls `getAccess` on the created FunctionDecl. As we passed in a RecordDecl as the DeclContext
for the FunctionDecl, we end up hitting the assert in `getAccess` that checks that we never have
a Decl inside a Record without a valid AccessSpecifier. FunctionDecls are never in RecordDecls
(that would be a CXXMethodDecl) so setting a access specifier would not be the correct way to
fix this.

Instead this patch does the same thing that DWARFASTParserClang::ParseSubroutine is doing:
We pass in the FunctionDecl with the TranslationUnit as the DeclContext. That's not ideal but
it is how we currently do it when creating our debug info AST, so the unit test should do
the same.

Reviewers: shafik

Reviewed By: shafik

Subscribers: aprantl, JDevlieghere, lldb-commits

Tags: #lldb

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




More information about the All-commits mailing list