[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 18 09:43:08 PDT 2022


Trass3r marked 5 inline comments as done.
Trass3r added inline comments.


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:7787-7788
+///     void f() {}
+///     void g();
+///   };
+/// \endcode
----------------
aaron.ballman wrote:
> I think it'd be interesting to show some other cases here -- like when the inline keyword is specified on a declaration without a visible definition or when the inline keyword is used on a declaration with a non-inline definition. (And update the comment below accordingly with what is matched.)
> inline keyword is specified on a declaration without a visible definition

According to https://learn.microsoft.com/en-us/cpp/build/reference/zc-inline-remove-unreferenced-comdat that's not standard-compliant?
But anyways those sound more like use-cases of the existing isInline matcher to me.

This one is more focused on those implicit inline methods which you can't find easily with a simple text search. I've also considered an alternative `isImplicitlyInline` matcher which would exclude explicit inline usage but I'm not sure which design is better. 
It seems I ended up with this inclusive design because I wanted to match the opposite: `cxxMethodDecl(unless(isEffectivelyInline())`.


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