100 const auto *Call = Result.Nodes.getNodeAs<CallExpr>(
"call");
101 assert(Call !=
nullptr);
102 const FunctionDecl *Callee = Call->getDirectCallee();
106 const StringRef Old = Callee->getName();
108 const llvm::Triple::ArchType Arch =
109 Result.Context->getTargetInfo().getTriple().getArch();
116 case llvm::Triple::ppc:
117 case llvm::Triple::ppc64:
118 case llvm::Triple::ppc64le:
121 case llvm::Triple::x86:
122 case llvm::Triple::x86_64:
132 static const llvm::Regex StdRegex(
"\\$std"), SimdRegex(
"\\$simd");
133 diag(Call->getExprLoc(),
"'%0' can be replaced by %1")
135 << SimdRegex.sub(SmallString<32>({Std,
"::simd"}),
136 StdRegex.sub(Std, New));
138 diag(Call->getExprLoc(),
"'%0' is a non-portable %1 intrinsic function")
139 << Old << llvm::Triple::getArchTypeName(Arch);
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.