Skip to content
Commit eabc7add authored by dingfei's avatar dingfei
Browse files

[clang][ASTImporter] Remove extra FunctionTemplateDecl introduced by templated friend

An extranous FunctionTemplateDecl is introduced in the following testcase:

  template <typename T> struct A {
    template <typename U> friend void f();
  };

"To" Context:

  ClassTemplateDecl 0x55dae7116618 <input.cc:1:1, col:73> col:30 A
  |-TemplateTypeParmDecl 0x55dae7116490 <col:11, col:20> col:20 typename depth 0 index 0 T
  `-CXXRecordDecl 0x55dae7116550 <col:23, col:73> col:30 struct A 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 simple trivial has_const_param needs_implicit implicit_has_const_param
    | |-MoveAssignment exists simple trivial needs_implicit
    | `-Destructor simple irrelevant trivial needs_implicit
    |-FunctionTemplateDecl 0x55dae7116a38 parent 0x55dae6fa2b68 <col:35, col:71> col:69 f                            // extranous node
    | |-TemplateTypeParmDecl 0x55dae7116860 <col:45, col:54> col:54 typename depth 1 index 0 U
    | `-FunctionDecl 0x55dae7116968 parent 0x55dae6fa2b68 <col:57, col:71> col:69 f 'void ()'
    |-FriendDecl 0x55dae7116aa0 <col:35, col:71> col:69
    | `-FunctionTemplateDecl 0x55dae7116a38 parent 0x55dae6fa2b68 <col:35, col:71> col:69 f
    |   |-TemplateTypeParmDecl 0x55dae7116860 <col:45, col:54> col:54 typename depth 1 index 0 U
    |   `-FunctionDecl 0x55dae7116968 parent 0x55dae6fa2b68 <col:57, col:71> col:69 f 'void ()'
    `-CXXRecordDecl 0x55dae7116ae0 <col:23, col:30> col:30 implicit struct A

Reviewed By: balazske

Differential Revision: https://reviews.llvm.org/D157691
parent 3b0eeb6c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment