[PATCH] D24268: Traversing template paramter lists of DeclaratorDecls and/or TagDecls.

Ɓukasz Anforowicz via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 10:27:36 PDT 2016


lukasza created this revision.
lukasza added a reviewer: rsmith.
lukasza added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

The unit tests in this patch demonstrate the need to traverse template
parameter lists of DeclaratorDecls (e.g. VarDecls, CXXMethodDecls) and
TagDecls (e.g. EnumDecls, RecordDecls).  Without new traversal code
in RecursiveASTVisitor, the new unit tests would trigger an assert
failure in MatchASTVisitor::matchesAncestorOfRecursively while verifing
that all AST nodes have a parent:
  bool matchesAncestorOfRecursively(const ast_type_traits::DynTypedNode &Node,
                                    ...) {
    const auto &Parents = ActiveASTContext->getParents(Node);
    assert(!Parents.empty() && "Found node that is not in the parent map.");

Fixes PR29042.

https://reviews.llvm.org/D24268

Files:
  include/clang/AST/RecursiveASTVisitor.h
  unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24268.70428.patch
Type: text/x-patch
Size: 4956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160906/8cdcfdfd/attachment-0001.bin>


More information about the cfe-commits mailing list