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