Skip to content

Commit

Permalink
Merge pull request #1160 from Teemperor/cherry/TemplateSpezModuleOwne…
Browse files Browse the repository at this point in the history
…rship

Backport template specialization ownership commits
  • Loading branch information
fredriss authored May 7, 2020
2 parents 4af0f79 + 8db6be6 commit a28b1b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
10 changes: 1 addition & 9 deletions lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1555,15 +1555,7 @@ TypeSystemClang::CreateClassTemplateSpecializationDecl(
ast.getTypeDeclType(class_template_specialization_decl, nullptr);
class_template_specialization_decl->setDeclName(
class_template_decl->getDeclName());
// FIXME: Turning this on breaks the libcxx data formatter tests.
// SetOwningModule marks the Decl as external, which prevents a
// LookupPtr from being built. Template instantiations can also not
// be found by ExternalASTSource::FindExternalVisibleDeclsByName(),
// nor can we lazily build a LookupPtr later, because template
// specializations are supposed to be hidden so
// makeDeclVisibleInContextWithFlags() is a noop, as well.
//
// SetOwningModule(class_template_specialization_decl, owning_module);
SetOwningModule(class_template_specialization_decl, owning_module);
decl_ctx->addDecl(class_template_specialization_decl);

class_template_specialization_decl->setSpecializationKind(
Expand Down
7 changes: 4 additions & 3 deletions lldb/test/Shell/SymbolFile/DWARF/module-ownership.mm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: %clang --target=x86_64-apple-macosx -g -gmodules \
// RUN: -fmodules -fmodules-cache-path=%t.cache \
// RUN: -c -o %t.o %s -I%S/Inputs
// RUN: lldb-test symbols -dump-clang-ast %t.o | FileCheck %s
// Verify that the owning module information from DWARF is preserved in the AST.

@import A;
Expand Down Expand Up @@ -51,10 +52,10 @@ @implementation SomeClass {

// Template specializations are not yet supported, so they lack the ownership info:
Template<int> t2;
// CHECK-DAG: ClassTemplateSpecializationDecl {{.*}} struct Template
// CHECK-DAG: ClassTemplateSpecializationDecl {{.*}} imported in A struct Template

Namespace::InNamespace<int> t3;
// CHECK-DAG: ClassTemplateSpecializationDecl {{.*}} struct InNamespace
// CHECK-DAG: ClassTemplateSpecializationDecl {{.*}} imported in A struct InNamespace

Namespace::AlsoInNamespace<int> t4;
// CHECK-DAG: ClassTemplateSpecializationDecl {{.*}} struct AlsoInNamespace
// CHECK-DAG: ClassTemplateSpecializationDecl {{.*}} imported in A.B struct AlsoInNamespace

0 comments on commit a28b1b8

Please sign in to comment.