Skip to content
  • David Blaikie's avatar
    DebugInfo: Avoid redundantly adding child DIEs to parents. · 811bfe63
    David Blaikie authored
    DIE::addChild had a shortcircuit that silently no-op'd when a child was
    readded to the same parent. This hid some quirky/redundant code in
    DwarfDebug/CompileUnit. By removing that functionality and replacing it
    with an assert I was able to find and cleanup those cases, mostly
    centering around adding members to types in various circumstances.
    
    1) The original oddity I noticed while working on type units (which
    actually was helping me in the short term, by accident) was the
    addToContextOwner call in constructTypeDIE. This call was completely
    bogus (why was it only done for non-virtual types? what relevance does
    that have at all) and redundant with the more uniform addToContextOwner
    made in getOrCreateTypeDIE.
    
    2) If a member function definition was visited (createSubprogramDIE), it
    would attempt to build the member function declaration. The declaration
    DIE would then be added to its context, but in building the context (the
    type for which this function is a member) the members of the type would
    be added to the type automatically, so by the time the context was
    constructed, the member function was already associated with it.
    
    3) The same as (2) but without the member function being constructed
    first. Whenever a type was constructed, the members would be created and
    member functions would be created by getOrCreateSubprogramDIE - this
    would lead to the subprogram being added to the (incomplete) type
    already, then the general member-construction code would add it again.
    
    llvm-svn: 191928
    811bfe63
Loading