@@ -67,6 +67,11 @@ static auto typeWithNameIn(const std::vector<StringRef> &Names) {
6767 hasCanonicalType (hasDeclaration (namedDecl (hasAnyName (Names)))));
6868}
6969
70+ static auto functionWithNameIn (const std::vector<StringRef> &Names) {
71+ auto Call = callExpr (callee (functionDecl (hasAnyName (Names))));
72+ return anyOf (expr (cxxBindTemporaryExpr (has (Call))), expr (Call));
73+ }
74+
7075CoroutineHostileRAIICheck::CoroutineHostileRAIICheck (StringRef Name,
7176 ClangTidyContext *Context)
7277 : ClangTidyCheck(Name, Context),
@@ -83,9 +88,8 @@ void CoroutineHostileRAIICheck::registerMatchers(MatchFinder *Finder) {
8388 hasAttr (attr::Kind::ScopedLockable)))))
8489 .bind (" scoped-lockable" );
8590 auto OtherRAII = varDecl (typeWithNameIn (RAIITypesList)).bind (" raii" );
86- auto AllowedSuspend = awaitable (
87- anyOf (typeWithNameIn (AllowedAwaitablesList),
88- callExpr (callee (functionDecl (hasAnyName (AllowedCallees))))));
91+ auto AllowedSuspend = awaitable (anyOf (typeWithNameIn (AllowedAwaitablesList),
92+ functionWithNameIn (AllowedCallees)));
8993 Finder->addMatcher (
9094 expr (anyOf (coawaitExpr (unless (AllowedSuspend)), coyieldExpr ()),
9195 forEachPrevStmt (
@@ -113,9 +117,9 @@ void CoroutineHostileRAIICheck::storeOptions(
113117 ClangTidyOptions::OptionMap &Opts) {
114118 Options.store (Opts, " RAIITypesList" ,
115119 utils::options::serializeStringList (RAIITypesList));
116- Options.store (Opts, " SafeAwaitableList " ,
120+ Options.store (Opts, " AllowedAwaitablesList " ,
117121 utils::options::serializeStringList (AllowedAwaitablesList));
118- Options.store (Opts, " SafeCallees " ,
122+ Options.store (Opts, " AllowedCallees " ,
119123 utils::options::serializeStringList (AllowedCallees));
120124}
121125} // namespace clang::tidy::misc
0 commit comments