Implement initial support for function attributes, including parser, printer,
resolver support.

Still TODO are verifier support (to make sure you don't use an attribute for a
function in another module) and the TODO in ModuleParser::finalizeModule that I
will handle in the next patch.

PiperOrigin-RevId: 209361648
diff --git a/lib/IR/Function.cpp b/lib/IR/Function.cpp
index df3d7c8..bfcfd6f 100644
--- a/lib/IR/Function.cpp
+++ b/lib/IR/Function.cpp
@@ -15,6 +15,7 @@
 // limitations under the License.
 // =============================================================================
 
+#include "mlir/IR/Attributes.h"
 #include "mlir/IR/CFGFunction.h"
 #include "mlir/IR/MLFunction.h"
 #include "mlir/IR/Module.h"
@@ -27,6 +28,11 @@
 Function::Function(StringRef name, FunctionType *type, Kind kind)
     : kind(kind), name(Identifier::get(name, type->getContext())), type(type) {}
 
+Function::~Function() {
+  // Clean up function attributes referring to this function.
+  FunctionAttr::dropFunctionReference(this);
+}
+
 MLIRContext *Function::getContext() const { return getType()->getContext(); }
 
 /// Delete this object.