10 #include "clang/AST/ASTContext.h" 11 #include "clang/ASTMatchers/ASTMatchFinder.h" 19 void AvoidNSErrorInitCheck::registerMatchers(MatchFinder *Finder) {
21 if (!getLangOpts().ObjC)
24 Finder->addMatcher(objcMessageExpr(hasSelector(
"init"),
25 hasReceiverType(asString(
"NSError *")))
30 void AvoidNSErrorInitCheck::check(
const MatchFinder::MatchResult &
Result) {
31 const auto *MatchedExpr =
32 Result.Nodes.getNodeAs<ObjCMessageExpr>(
"nserrorInit");
33 diag(MatchedExpr->getBeginLoc(),
34 "use errorWithDomain:code:userInfo: or initWithDomain:code:userInfo: to " 35 "create a new NSError");
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result