/// Unlink this function from its module and delete it.
void erase();
+ /// Returns true if this function is external, i.e. it has no body.
+ bool isExternal() const { return empty(); }
+
//===--------------------------------------------------------------------===//
// Body Handling
//===--------------------------------------------------------------------===//
fn.getName().c_str());
// External functions have nothing more to check.
- if (fn.empty())
+ if (fn.isExternal())
return false;
// Verify the first block has no predecessors.
auto fnType = function->getType();
// If this is an external function, don't print argument labels.
- if (function->empty()) {
+ if (function->isExternal()) {
interleaveComma(fnType.getInputs(),
[&](Type eltType) { printType(eltType); });
} else {
PassResult FunctionPass::runOnModule(Module *m) {
for (auto &fn : *m) {
// All function passes ignore external functions.
- if (fn.empty())
+ if (fn.isExternal())
continue;
if (runOnFunction(&fn))
// Convert functions.
for (const Function &function : mlirModule) {
// Ignore external functions.
- if (function.empty())
+ if (function.isExternal())
continue;
if (convertOneFunction(function))