private void encodeComments(Encoder encoder, Address addr, Function func, int flags)
			throws IOException {
		AddressSetView addrset = func.getBody();
		encoder.openElement(ELEM_COMMENTDB);
		if ((flags & 8) != 0) {
			encodeHeaderComment(encoder, func);
		}
		if ((flags & 1) != 0) {
			encodeCommentsType(encoder, addrset, addr, CommentType.EOL);
		}
		if ((flags & 2) != 0) {
			encodeCommentsType(encoder, addrset, addr, CommentType.PRE);
		}
		if ((flags & 4) != 0) {
			encodeCommentsType(encoder, addrset, addr, CommentType.POST);
		}
		if ((flags & 8) != 0) {
			encodeCommentsType(encoder, addrset, addr, CommentType.PLATE);
		}
		encoder.closeElement(ELEM_COMMENTDB);
	}
Encode comments of a specific type to stream for a given address set.  Comments are
collected from the listing.  The encoding associates the comment both with the address where
it was placed, but also with the (entry point) address of the function containing it.
Plate comments whose address matches the function entry point are not encoded.

@param encoder is the stream encoder
@param addrset is the address set over which to search
@param addr is the entry point of the function
@param commenttype is the type of comment
@throws IOException for errors in the underlying stream
Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.java