[clang] [CIR] Add support for the IdiomRecognizer pass (PR #208854)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 13 07:19:19 PDT 2026
================
@@ -3537,6 +3540,23 @@ void CIRGenModule::setCXXSpecialMemberAttr(
}
}
+void CIRGenModule::setFuncIdentityAttr(cir::FuncOp funcOp,
+ const clang::FunctionDecl *funcDecl) {
+ // Only a free std function with a plain identifier can match a known
+ // entity, so members, static members, and operators never take a tag.
+ // Inline namespaces, like the versioning namespace of libc++, count as
+ // part of std.
+ if (!funcDecl || !funcDecl->getIdentifier() || isa<CXXMethodDecl>(funcDecl) ||
+ !funcDecl->isInStdNamespace())
+ return;
+
+ // The names and the tags come from CIRStdOps.td, and the recognizer
+ // checks the shape of each call.
+ if (funcDecl->getName() == cir::StdFindOp::getFunctionName())
----------------
erichkeane wrote:
This seems like we really need to set up a `llvm::StringSwitch` on the name for a name->enum conversion function.
https://github.com/llvm/llvm-project/pull/208854
More information about the cfe-commits
mailing list