[PATCH] D135690: [ASTMatchers] Add matcher for functions that are effectively inline

Trass3r via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 16:30:37 PDT 2022


Trass3r added inline comments.


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:7791
+/// functionDecl(isEffectivelyInline()) will match f().
+AST_MATCHER(FunctionDecl, isEffectivelyInline) { return Node.isInlined(); }
+
----------------
Is there any value in adding variables?
I guess that would mainly target constexpr vars, for which there is `isConstexpr`.


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchersMacros.h:96
   namespace internal {                                                         \
-  class matcher_##DefineMatcher##Matcher                                       \
+  class matcher_##DefineMatcher##Matcher final                                 \
       : public ::clang::ast_matchers::internal::MatcherInterface<Type> {       \
----------------
ziqingluo-90 wrote:
> I was wondering if this change is necessary.  This definition is so general that it could affect a massive matchers.  So any change to it should be very careful and unnecessary changes may be avoided.
> 
> Other than that, this patch looks good to me.
Just came across it. Since it's a macro-internal class I couldn't see any potential breakage. Nobody should inherit from that. But I can take it out.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135690/new/

https://reviews.llvm.org/D135690



More information about the cfe-commits mailing list