/// Return the name of this function, without the @.
Identifier getName() { return name; }
+ /// Swap the name of the given function with this one. The caller must ensure
+ /// that all existing references to the current name of each function have
+ /// been properly updated.
+ void takeName(Function &rhs);
+
/// Return the type of this function.
FunctionType getType() { return type; }
private:
friend struct llvm::ilist_traits<Function>;
+ friend class Function;
/// getSublistAccess() - Returns pointer to member of function list
static FunctionListType Module::*getSublistAccess(Function *) {
MLIRContext *Function::getContext() { return getType().getContext(); }
+/// Swap the name of the given function with this one.
+void Function::takeName(Function &rhs) {
+ auto *module = getModule();
+ assert(module && module == rhs.getModule() && "expected same parent module");
+ std::swap(module->symbolTable[name], module->symbolTable[rhs.getName()]);
+ std::swap(name, rhs.name);
+}
+
Module *llvm::ilist_traits<Function>::getContainingModule() {
size_t Offset(
size_t(&((Module *)nullptr->*Module::getSublistAccess(nullptr))));