[clang] [CIR] Generalize the special member attribute into func_info and add a callee resolver (PR #207261)
Rithik Sharma via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 7 17:24:53 PDT 2026
================
@@ -1051,6 +1051,27 @@ unsigned cir::CallOp::getNumArgOperands() {
return this->getOperation()->getNumOperands();
}
+static cir::FuncOp resolveCalleeImpl(mlir::Operation *op,
+ mlir::SymbolTableCollection *symbolTable) {
+ auto callee = op->getAttrOfType<mlir::FlatSymbolRefAttr>(
+ CIRDialect::getCalleeAttrName());
+ if (!callee)
+ return {};
+
+ if (symbolTable)
+ return symbolTable->lookupNearestSymbolFrom<cir::FuncOp>(op, callee);
+ return mlir::SymbolTable::lookupNearestSymbolFrom<cir::FuncOp>(op, callee);
----------------
SharmaRithik wrote:
It works. `lookupNearestSymbolFrom` takes any op and walks up to the nearest symbol table by itself, so the call op is enough. `verifyCallCommInSymbolUses` in this file does the same thing, and the unit test covers it.
https://github.com/llvm/llvm-project/pull/207261
More information about the cfe-commits
mailing list