Page MenuHomePhabricator

[ASTImporter] Fix missing implict CXXRecordDecl
ClosedPublic

Authored by martong on May 16 2018, 8:55 AM.

Details

Summary

Implicit CXXRecordDecl is not added to its DeclContext during import, but in
the original AST it is. This patch fixes this.

Diff Detail

Repository
rL LLVM

Event Timeline

martong created this revision.May 16 2018, 8:55 AM
a.sidorin accepted this revision.May 16 2018, 9:59 AM

So, we fail to add injected name to a CXXRecordDecl that has a described class template? Nice catch! LGTM.

This revision is now accepted and ready to land.May 16 2018, 9:59 AM

So, we fail to add injected name to a CXXRecordDecl that has a described class template?

Yes, we failed to import the implicit CXXRecordDecl.
Here is how it looked before the fix:

From:
ClassTemplateDecl 0xecae28 <input.cc:2:7, line:4:7> line:3:14 declToImport
|-TemplateTypeParmDecl 0xecacd8 <line:2:17, col:26> col:26 typename depth 0 index 0 U
`-CXXRecordDecl 0xecad90 <line:3:7, line:4:7> line:3:14 struct declToImport definition
  |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
  | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
  | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
  | |-MoveConstructor exists simple trivial needs_implicit
  | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
  | |-MoveAssignment exists simple trivial needs_implicit
  | `-Destructor simple irrelevant trivial needs_implicit
  `-CXXRecordDecl 0xecb0a0 <col:7, col:14> col:14 implicit struct declToImport
To:
ClassTemplateDecl 0xf97cb0 <input.cc:2:7, line:3:14> col:14 declToImport
|-TemplateTypeParmDecl 0xf97c00 <line:2:17, col:26> col:26 typename depth 0 index 0 U
`-CXXRecordDecl 0xf97a48 <line:3:7, col:14> col:14 struct declToImport definition
  `-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
    |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
    |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
    |-MoveConstructor exists simple trivial needs_implicit
    |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
    |-MoveAssignment exists simple trivial needs_implicit
    `-Destructor simple irrelevant trivial needs_implicit

Thanks for the review.

This revision was automatically updated to reflect the committed changes.