This is necessary so that when we wish to print the matchers for a
binding of type CXXMeethodDecl, but which was matched with a base
matcher such as functionDecl() we can inform the user that they can
write functionDecl(cxxMethodDecl(isOverride())) etc.
Details
- Reviewers
aaron.ballman sbenza
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 24919 Build 24918: arc lint + arc unit
Event Timeline
Adding @sbenza in case he has opinions on this approach. I think it's reasonable, but I also know that changes to the the AST matcher internals sometimes have unintended side effects with the various instantiations.
include/clang/ASTMatchers/ASTMatchersInternal.h | ||
---|---|---|
198–199 | Use of a std::pair here is unfortunate because it's really hard to keep track of what first and second actually mean. A tiny aggregate with two named members would help. |
The problem used to come with the number of template instantiations, but afaik this was with an MSVC configuration that is no longer supported.
In any case, I don't see this change making new template instantiations.
I also don't see any actual use of this newly stored data so I don't see the goal. Is this for diagnostics on failures or something like that?
This commit is part of a series. You can see the use of this in the next commit: https://reviews.llvm.org/D54408
Ah, I think I was remembering the issues from binary sizes due to template instantiations. I didn't think this would introduce new instantiations, but I thought it might make them all larger in a harmful way. I don't think that's a concern here, but your second set of eyes doesn't hurt.
include/clang/ASTMatchers/ASTMatchersInternal.h | ||
---|---|---|
153 | other -> Other | |
154 | This doesn't provide the right ordering guarantees. Use std::tie() instead: return std::tie(DynNode, NodeKind) < std::tie(Other.DynNode, Other.NodeKind); |
Aside from a minor formatting nit, LGTM.
include/clang/ASTMatchers/ASTMatchersInternal.h | ||
---|---|---|
154 | 80 col. |
include/clang/ASTMatchers/ASTMatchersInternal.h | ||
---|---|---|
154 | Thanks, I forgot about tie :). |
other -> Other