[PATCH] D48242: [ASTMatchers] Add support for matching the type of a friend decl.

David L. Jones via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 15 17:21:18 PDT 2018


dlj added inline comments.


================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:2900-2904
+AST_POLYMORPHIC_MATCHER_P_OVERLOAD(
+    hasType,
+    AST_POLYMORPHIC_SUPPORTED_TYPES(Expr, FriendDecl, ValueDecl),
+    internal::Matcher<Decl>, InnerMatcher, 1) {
+  QualType QT = internal::getUnderlyingType(Node);
----------------
aaron.ballman wrote:
> I actually prefer the previous formatting, can you restore that?
Hmmm, it barely fits in 80 cols if I use the previous flow, but looks worse to me (it adds another line just for FriendDecl). I've updated to exactly what clang-format prefers, which happens to be fairly consistent with the other declaration of hasType.


================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:2904
+    internal::Matcher<Decl>, InnerMatcher, 1) {
+  QualType QT = internal::getUnderlyingType(Node);
+  if (!QT.isNull())
----------------
klimek wrote:
> In which cases can getUnderlyingType return a null type?
QT can be null for a FriendDecl that that doesn't name a type. That seems to DTRT here.


Repository:
  rC Clang

https://reviews.llvm.org/D48242





More information about the cfe-commits mailing list