[PATCH] D128314: [Clang-tidy] Fixing a bug in clang-tidy infinite-loop checker

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 1 18:08:55 PDT 2022


ziqingluo-90 added a comment.

In D128314#3605588 <https://reviews.llvm.org/D128314#3605588>, @NoQ wrote:

> Nice!
>
> There's usually some bureaucracy when creating new matchers, i.e. there should be documentation and unittests covering them.

I have added a unit test and auto-generated document for it.



================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:5099
+/// matches a FunctionType if the type includes the GNU no return attribute
+AST_MATCHER(FunctionType, typeHasNoReturnAttr) {
+  return Node.getNoReturnAttr();
----------------
NoQ wrote:
> Can we make a polymorphic matcher `hasNoReturnAttr` that can accept either decl or type?
I've moved these two matchers, which seems are specific to the infinite loop checker, to `InfiniteLoopCheck.cpp`.  Maybe they no longer need to be generalized by polymorphism. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128314



More information about the cfe-commits mailing list