Skip to content
Snippets Groups Projects
  • Manuel Klimek's avatar
    81937d82
    Unify and simplify the behavior of the hasDeclaration matcher. · 81937d82
    Manuel Klimek authored
    Originally, we weren't able to match on Type nodes themselves (only QualType),
    so the hasDeclaration matcher was initially written to give what we thought are
    reasonable results for QualType matches.
    
    When we chagned the matchers to allow matching on Type nodes, it turned out
    that the hasDeclaration matcher was by chance written templated enough to now
    allow hasDeclaration to also match on (some) Type nodes.
    
    This patch change the hasDeclaration matcher to:
    a) work the same on Type and QualType nodes,
    b) be completely explicit about what nodes we can match instead of just allowing
       anything with a getDecl() to match,
    c) explicitly control desugaring only one level in very specific instances.
    d) adds hasSpecializedTemplate and tagType matchers to allow migrating
      existing use cases that now need more explicit matchers
    
    Note: This patch breaks clang-tools-extra. The corresponding patch there
    is approved and will land in a subsequent patch.
    
    Differential Revision: https://reviews.llvm.org/D27104
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309809 91177308-0d34-0410-b5e6-96231b3b80d8
    81937d82
    History
    Unify and simplify the behavior of the hasDeclaration matcher.
    Manuel Klimek authored
    Originally, we weren't able to match on Type nodes themselves (only QualType),
    so the hasDeclaration matcher was initially written to give what we thought are
    reasonable results for QualType matches.
    
    When we chagned the matchers to allow matching on Type nodes, it turned out
    that the hasDeclaration matcher was by chance written templated enough to now
    allow hasDeclaration to also match on (some) Type nodes.
    
    This patch change the hasDeclaration matcher to:
    a) work the same on Type and QualType nodes,
    b) be completely explicit about what nodes we can match instead of just allowing
       anything with a getDecl() to match,
    c) explicitly control desugaring only one level in very specific instances.
    d) adds hasSpecializedTemplate and tagType matchers to allow migrating
      existing use cases that now need more explicit matchers
    
    Note: This patch breaks clang-tools-extra. The corresponding patch there
    is approved and will land in a subsequent patch.
    
    Differential Revision: https://reviews.llvm.org/D27104
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309809 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.