Skip to content
Snippets Groups Projects
  • Vedant Kumar's avatar
    bb9efcc8
    [Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679) · bb9efcc8
    Vedant Kumar authored
    The coverage implementation marks functions which won't be emitted as
    'deferred', so that it can emit empty coverage regions for them later
    (once their linkages are known).
    
    Functions in dependent contexts are an exception: if there isn't a full
    instantiation of a function, it shouldn't be marked 'deferred'. We've
    been breaking that rule without much consequence because we just ended
    up with useless, extra, empty coverage mappings. With PR32679, this
    behavior finally caused a crash, because clang marked a partial template
    specialization as 'deferred', causing the MS mangler to choke in its
    delayed-template-parsing mode:
    
      error: cannot mangle this template type parameter type yet
      (http://bugs.llvm.org/show_bug.cgi?id=32679)
    
    Fix this by checking if a decl's context is a dependent context before
    marking it 'deferred'.
    
    Based on a patch by Adam Folwarczny!
    
    Differential Revision: https://reviews.llvm.org/D32144
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300723 91177308-0d34-0410-b5e6-96231b3b80d8
    bb9efcc8
    History
    [Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)
    Vedant Kumar authored
    The coverage implementation marks functions which won't be emitted as
    'deferred', so that it can emit empty coverage regions for them later
    (once their linkages are known).
    
    Functions in dependent contexts are an exception: if there isn't a full
    instantiation of a function, it shouldn't be marked 'deferred'. We've
    been breaking that rule without much consequence because we just ended
    up with useless, extra, empty coverage mappings. With PR32679, this
    behavior finally caused a crash, because clang marked a partial template
    specialization as 'deferred', causing the MS mangler to choke in its
    delayed-template-parsing mode:
    
      error: cannot mangle this template type parameter type yet
      (http://bugs.llvm.org/show_bug.cgi?id=32679)
    
    Fix this by checking if a decl's context is a dependent context before
    marking it 'deferred'.
    
    Based on a patch by Adam Folwarczny!
    
    Differential Revision: https://reviews.llvm.org/D32144
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300723 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.