Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / metadata / reflection.c
index 43843be4a5a676a9f8f34808588688bbbf81f150..f8e9f37fb49c37774f7aa70a6ce8e5980add9a93 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * reflection.c: System.Type icalls and related reflection queries.
+/**
+ * \file
+ * System.Type icalls and related reflection queries.
  * 
  * Author:
  *   Paolo Molaro (lupus@ximian.com)
@@ -142,7 +143,9 @@ mono_class_free_ref_info (MonoClass *klass)
        }
 }
 
-
+/**
+ * mono_custom_attrs_free:
+ */
 void
 mono_custom_attrs_free (MonoCustomAttrInfo *ainfo)
 {
@@ -152,7 +155,6 @@ mono_custom_attrs_free (MonoCustomAttrInfo *ainfo)
                g_free (ainfo);
 }
 
-
 gboolean
 reflected_equal (gconstpointer a, gconstpointer b)
 {
@@ -171,7 +173,6 @@ reflected_hash (gconstpointer a) {
        return seed;
 }
 
-
 static void
 clear_cached_object (MonoDomain *domain, gpointer o, MonoClass *klass)
 {
@@ -182,42 +183,36 @@ clear_cached_object (MonoDomain *domain, gpointer o, MonoClass *klass)
 
                pe.item = o;
                pe.refclass = klass;
-               if (mono_g_hash_table_lookup_extended (domain->refobject_hash, &pe, &orig_pe, &orig_value)) {
-                       mono_g_hash_table_remove (domain->refobject_hash, &pe);
-                       FREE_REFENTRY (orig_pe);
+
+               if (mono_conc_g_hash_table_lookup_extended (domain->refobject_hash, &pe, &orig_pe, &orig_value)) {
+                       mono_conc_g_hash_table_remove (domain->refobject_hash, &pe);
+                       free_reflected_entry (orig_pe);
                }
        }
        mono_domain_unlock (domain);
 }
 
-#ifdef REFENTRY_REQUIRES_CLEANUP
 static void
 cleanup_refobject_hash (gpointer key, gpointer value, gpointer user_data)
 {
-       FREE_REFENTRY (key);
+       free_reflected_entry (key);
 }
-#endif
 
 void
 mono_reflection_cleanup_domain (MonoDomain *domain)
 {
        if (domain->refobject_hash) {
-/*let's avoid scanning the whole hashtable if not needed*/
-#ifdef REFENTRY_REQUIRES_CLEANUP
-               mono_g_hash_table_foreach (domain->refobject_hash, cleanup_refobject_hash, NULL);
-#endif
-               mono_g_hash_table_destroy (domain->refobject_hash);
+               mono_conc_g_hash_table_foreach (domain->refobject_hash, cleanup_refobject_hash, NULL);
+               mono_conc_g_hash_table_destroy (domain->refobject_hash);
                domain->refobject_hash = NULL;
        }
 }
 
-
-/*
+/**
  * mono_assembly_get_object:
- * @domain: an app domain
- * @assembly: an assembly
- *
- * Return an System.Reflection.Assembly object representing the MonoAssembly @assembly.
+ * \param domain an app domain
+ * \param assembly an assembly
+ * \returns a \c System.Reflection.Assembly object representing the \c MonoAssembly \p assembly.
  */
 MonoReflectionAssembly*
 mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly)
@@ -253,6 +248,9 @@ mono_assembly_get_object_handle (MonoDomain *domain, MonoAssembly *assembly, Mon
        return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionAssemblyHandle, assembly, NULL, assembly_object_construct, NULL);
 }
 
+/**
+ * mono_module_get_object:
+ */
 MonoReflectionModule*   
 mono_module_get_object   (MonoDomain *domain, MonoImage *image)
 {
@@ -319,6 +317,9 @@ mono_module_get_object_handle (MonoDomain *domain, MonoImage *image, MonoError *
        return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionModuleHandle, image, NULL, module_object_construct, NULL);
 }
 
+/**
+ * mono_module_file_get_object:
+ */
 MonoReflectionModule*
 mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_index)
 {
@@ -424,12 +425,12 @@ mono_type_normalize (MonoType *type)
 
        return type;
 }
-/*
+
+/**
  * mono_type_get_object:
- * @domain: an app domain
- * @type: a type
- *
- * Return an System.MonoType object representing the type @type.
+ * \param domain an app domain
+ * \param type a type
+ * \returns A \c System.MonoType object representing the type \p type.
  */
 MonoReflectionType*
 mono_type_get_object (MonoDomain *domain, MonoType *type)
@@ -561,13 +562,12 @@ mono_type_get_object_handle (MonoDomain *domain, MonoType *type, MonoError *erro
        return MONO_HANDLE_NEW (MonoReflectionType, mono_type_get_object_checked (domain, type, error));
 }
 
-/*
+/**
  * mono_method_get_object:
- * @domain: an app domain
- * @method: a method
- * @refclass: the reflected type (can be NULL)
- *
- * Return an System.Reflection.MonoMethod object representing the method @method.
+ * \param domain an app domain
+ * \param method a method
+ * \param refclass the reflected type (can be NULL)
+ * \returns A \c System.Reflection.MonoMethod object representing the method \p method.
  */
 MonoReflectionMethod*
 mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refclass)
@@ -677,14 +677,13 @@ mono_method_clear_object (MonoDomain *domain, MonoMethod *method)
        }
 }
 
-/*
+/**
  * mono_field_get_object:
- * @domain: an app domain
- * @klass: a type
- * @field: a field
- *
- * Return an System.Reflection.MonoField object representing the field @field
- * in class @klass.
+ * \param domain an app domain
+ * \param klass a type
+ * \param field a field
+ * \returns A \c System.Reflection.MonoField object representing the field \p field
+ * in class \p klass.
  */
 MonoReflectionField*
 mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field)
@@ -796,13 +795,13 @@ fail:
 
 /**
  * mono_property_get_object_handle:
- * @domain: an app domain
- * @klass: a type
- * @property: a property
- * @error: set on error
+ * \param domain an app domain
+ * \param klass a type
+ * \param property a property
+ * \param error set on error
  *
- * Return an System.Reflection.MonoProperty object representing the property @property
- * in class @klass.  On error returns NULL and sets @error.
+ * \returns A \c System.Reflection.MonoProperty object representing the property \p property
+ * in class \p klass.  On error returns NULL and sets \p error.
  */
 MonoReflectionPropertyHandle
 mono_property_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoProperty *property, MonoError *error)
@@ -812,13 +811,12 @@ mono_property_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoPrope
 
 /**
  * mono_property_get_object:
- * @domain: an app domain
- * @klass: a type
- * @property: a property
- * @error: set on error
- *
- * Return an System.Reflection.MonoProperty object representing the property @property
- * in class @klass.  On error returns NULL and sets @error.
+ * \param domain an app domain
+ * \param klass a type
+ * \param property a property
+ * \param error set on error
+ * \returns a \c System.Reflection.MonoProperty object representing the property \p property
+ * in class \p klass.  On error returns NULL and sets \p error.
  */
 MonoReflectionProperty*
 mono_property_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoProperty *property, MonoError *error)
@@ -828,14 +826,13 @@ mono_property_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoProp
        HANDLE_FUNCTION_RETURN_OBJ (res);
 }
 
-/*
+/**
  * mono_event_get_object:
- * @domain: an app domain
- * @klass: a type
- * @event: a event
- *
- * Return an System.Reflection.MonoEvent object representing the event @event
- * in class @klass.
+ * \param domain an app domain
+ * \param klass a type
+ * \param event a event
+ * \returns A \c System.Reflection.MonoEvent object representing the event \p event
+ * in class \p klass.
  */
 MonoReflectionEvent*
 mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event)
@@ -862,13 +859,12 @@ event_object_construct (MonoDomain *domain, MonoClass *klass, MonoEvent *event,
 
 /**
  * mono_event_get_object_handle:
- * @domain: an app domain
- * @klass: a type
- * @event: a event
- * @error: set on error
- *
- * Return an System.Reflection.MonoEvent object representing the event @event
- * in class @klass. On failure sets @error and returns NULL
+ * \param domain an app domain
+ * \param klass a type
+ * \param event a event
+ * \param error set on error
+ * \returns a \c System.Reflection.MonoEvent object representing the event \p event
+ * in class \p klass. On failure sets \p error and returns NULL
  */
 MonoReflectionEventHandle
 mono_event_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoEvent *event, MonoError *error)
@@ -880,12 +876,12 @@ mono_event_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoEvent *e
 
 /**
  * mono_get_reflection_missing_object:
- * @domain: Domain where the object lives
+ * \param domain Domain where the object lives
  *
- * Returns the System.Reflection.Missing.Value singleton object
- * (of type System.Reflection.Missing).
+ * \returns the \c System.Reflection.Missing.Value singleton object
+ * (of type \c System.Reflection.Missing).
  *
- * Used as the value for ParameterInfo.DefaultValue when Optional
+ * Used as the value for \c ParameterInfo.DefaultValue when Optional
  * is present
  */
 static MonoObjectHandle
@@ -1122,6 +1118,9 @@ fail:
        return MONO_HANDLE_NEW (MonoArray, NULL_HANDLE);
 }
 
+/**
+ * mono_param_get_objects:
+ */
 MonoArray*
 mono_param_get_objects (MonoDomain *domain, MonoMethod *method)
 {
@@ -1186,12 +1185,11 @@ leave:
        HANDLE_FUNCTION_RETURN_VAL (is_ok (error));
 }
 
-/*
+/**
  * mono_method_body_get_object:
- * @domain: an app domain
- * @method: a method
- *
- * Return an System.Reflection.MethodBody object representing the method @method.
+ * \param domain an app domain
+ * \param method a method
+ * \return A \c System.Reflection.MethodBody object representing the method \p method.
  */
 MonoReflectionMethodBody*
 mono_method_body_get_object (MonoDomain *domain, MonoMethod *method)
@@ -1203,6 +1201,7 @@ mono_method_body_get_object (MonoDomain *domain, MonoMethod *method)
        HANDLE_FUNCTION_RETURN_OBJ (result);
 }
 
+/* WARNING: This method can return NULL on sucess */
 static MonoReflectionMethodBodyHandle
 method_body_object_construct (MonoDomain *domain, MonoClass *unused_class, MonoMethod *method, gpointer user_data, MonoError *error)
 {
@@ -1301,12 +1300,11 @@ fail:
 
 /**
  * mono_method_body_get_object_handle:
- * @domain: an app domain
- * @method: a method
- * @error: set on error
- *
- * Return an System.Reflection.MethodBody object representing the
- * method @method.  On failure, returns NULL and sets @error.
+ * \param domain an app domain
+ * \param method a method
+ * \param error set on error
+ * \returns a \c System.Reflection.MethodBody object representing the
+ * method \p method.  On failure, returns NULL and sets \p error.
  */
 MonoReflectionMethodBodyHandle
 mono_method_body_get_object_handle (MonoDomain *domain, MonoMethod *method, MonoError *error)
@@ -1318,11 +1316,9 @@ mono_method_body_get_object_handle (MonoDomain *domain, MonoMethod *method, Mono
 
 /**
  * mono_get_dbnull_object:
- * @domain: Domain where the object lives
- *
- * Returns the System.DBNull.Value singleton object
- *
- * Used as the value for ParameterInfo.DefaultValue 
+ * \param domain Domain where the object lives
+ * Used as the value for \c ParameterInfo.DefaultValue
+ * \returns the \c System.DBNull.Value singleton object
  */
 MonoObject *
 mono_get_dbnull_object (MonoDomain *domain)
@@ -1752,12 +1748,11 @@ _mono_reflection_parse_type (char *name, char **endptr, gboolean is_recursed,
 
 /**
  * mono_identifier_unescape_type_name_chars:
- * @identifier: the display name of a mono type
+ * \param identifier the display name of a mono type
  *
- * Returns:
- *  The name in internal form, that is without escaping backslashes.
+ * \returns The name in internal form, that is without escaping backslashes.
  *
- *  The string is modified in place!
+ * The string is modified in place!
  */
 char*
 mono_identifier_unescape_type_name_chars(char* identifier)
@@ -1802,9 +1797,7 @@ unescape_each_nested_name (void* data, void* user_data)
 /**
  * mono_identifier_unescape_info:
  *
- * @info: a parsed display form of an (optionally assembly qualified) full type name.
- *
- * Returns: nothing.
+ * \param info a parsed display form of an (optionally assembly qualified) full type name.
  *
  * Destructively updates the info by unescaping the identifiers that
  * comprise the type namespace, name, nested types (if any) and
@@ -1827,6 +1820,9 @@ mono_identifier_unescape_info (MonoTypeNameParse *info)
                g_list_foreach(info->nested, &unescape_each_nested_name, NULL);
 }
 
+/**
+ * mono_reflection_parse_type:
+ */
 int
 mono_reflection_parse_type (char *name, MonoTypeNameParse *info)
 {
@@ -1885,10 +1881,12 @@ _mono_reflection_get_type_from_info (MonoTypeNameParse *info, MonoImage *image,
 static MonoType*
 mono_reflection_get_type_internal (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, MonoError *error)
 {
+       HANDLE_FUNCTION_ENTER ();
        MonoClass *klass;
        GList *mod;
        int modval;
        gboolean bounded = FALSE;
+       MonoType* type = NULL;
        
        error_init (error);
        if (!image)
@@ -1903,7 +1901,7 @@ mono_reflection_get_type_internal (MonoImage *rootimage, MonoImage* image, MonoT
                klass = mono_class_from_name_checked (image, info->name_space, info->name, error);
 
        if (!klass)
-               return NULL;
+               goto leave;
 
        for (mod = info->nested; mod; mod = mod->next) {
                gpointer iter = NULL;
@@ -1963,7 +1961,7 @@ mono_reflection_get_type_internal (MonoImage *rootimage, MonoImage* image, MonoT
                        break;
        }
        if (!klass)
-               return NULL;
+               goto leave;
 
        if (info->type_arguments) {
                MonoType **type_args = g_new0 (MonoType *, info->type_arguments->len);
@@ -1977,20 +1975,20 @@ mono_reflection_get_type_internal (MonoImage *rootimage, MonoImage* image, MonoT
                        type_args [i] = _mono_reflection_get_type_from_info (subinfo, rootimage, ignorecase, error);
                        if (!type_args [i]) {
                                g_free (type_args);
-                               return NULL;
+                               goto leave;
                        }
                }
 
                the_type = mono_type_get_object_handle (mono_domain_get (), &klass->byval_arg, error);
                if (!is_ok (error) || MONO_HANDLE_IS_NULL (the_type))
-                       return NULL;
+                       goto leave;
 
                instance = mono_reflection_bind_generic_parameters (
                        the_type, info->type_arguments->len, type_args, error);
 
                g_free (type_args);
                if (!instance)
-                       return NULL;
+                       goto leave;
 
                klass = mono_class_from_mono_type (instance);
        }
@@ -1998,7 +1996,8 @@ mono_reflection_get_type_internal (MonoImage *rootimage, MonoImage* image, MonoT
        for (mod = info->modifiers; mod; mod = mod->next) {
                modval = GPOINTER_TO_UINT (mod->data);
                if (!modval) { /* byref: must be last modifier */
-                       return &klass->this_arg;
+                       type = &klass->this_arg;
+                       goto leave;
                } else if (modval == -1) {
                        klass = mono_ptr_class_get (&klass->byval_arg);
                } else if (modval == -2) {
@@ -2008,20 +2007,22 @@ mono_reflection_get_type_internal (MonoImage *rootimage, MonoImage* image, MonoT
                }
        }
 
-       return &klass->byval_arg;
+       type = &klass->byval_arg;
+
+leave:
+       HANDLE_FUNCTION_RETURN_VAL (type);
 }
 
-/*
+/**
  * mono_reflection_get_type:
- * @image: a metadata context
- * @info: type description structure
- * @ignorecase: flag for case-insensitive string compares
- * @type_resolve: whenever type resolve was already tried
+ * \param image a metadata context
+ * \param info type description structure
+ * \param ignorecase flag for case-insensitive string compares
+ * \param type_resolve whenever type resolve was already tried
  *
- * Build a MonoType from the type description in @info.
+ * Build a MonoType from the type description in \p info.
  * 
  */
-
 MonoType*
 mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve) {
        MonoError error;
@@ -2032,15 +2033,13 @@ mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ig
 
 /**
  * mono_reflection_get_type_checked:
- * @rootimage: the image of the currently active managed caller
- * @image: a metadata context
- * @info: type description structure
- * @ignorecase: flag for case-insensitive string compares
- * @type_resolve: whenever type resolve was already tried
- * @error: set on error.
- *
- * Build a MonoType from the type description in @info. On failure returns NULL and sets @error.
- *
+ * \param rootimage the image of the currently active managed caller
+ * \param image a metadata context
+ * \param info type description structure
+ * \param ignorecase flag for case-insensitive string compares
+ * \param type_resolve whenever type resolve was already tried
+ * \param error set on error.
+ * Build a \c MonoType from the type description in \p info. On failure returns NULL and sets \p error.
  */
 MonoType*
 mono_reflection_get_type_checked (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve, MonoError *error) {
@@ -2177,6 +2176,9 @@ mono_reflection_get_type_with_rootimage (MonoImage *rootimage, MonoImage* image,
        return type;
 }
 
+/**
+ * mono_reflection_free_type_info:
+ */
 void
 mono_reflection_free_type_info (MonoTypeNameParse *info)
 {
@@ -2198,13 +2200,13 @@ mono_reflection_free_type_info (MonoTypeNameParse *info)
        }
 }
 
-/*
+/**
  * mono_reflection_type_from_name:
- * @name: type name.
- * @image: a metadata context (can be NULL).
+ * \param name type name.
+ * \param image a metadata context (can be NULL).
  *
- * Retrieves a MonoType from its @name. If the name is not fully qualified,
- * it defaults to get the type from @image or, if @image is NULL or loading
+ * Retrieves a \c MonoType from its \p name. If the name is not fully qualified,
+ * it defaults to get the type from \p image or, if \p image is NULL or loading
  * from it fails, uses corlib.
  * 
  */
@@ -2219,14 +2221,12 @@ mono_reflection_type_from_name (char *name, MonoImage *image)
 
 /**
  * mono_reflection_type_from_name_checked:
- * @name: type name.
- * @image: a metadata context (can be NULL).
- * @error: set on errror.
- *
- * Retrieves a MonoType from its @name. If the name is not fully qualified,
- * it defaults to get the type from @image or, if @image is NULL or loading
- * from it fails, uses corlib.  On failure returns NULL and sets @error.
- * 
+ * \param name type name.
+ * \param image a metadata context (can be NULL).
+ * \param error set on errror.
+ * Retrieves a MonoType from its \p name. If the name is not fully qualified,
+ * it defaults to get the type from \p image or, if \p image is NULL or loading
+ * from it fails, uses corlib.  On failure returns NULL and sets \p error.
  */
 MonoType*
 mono_reflection_type_from_name_checked (char *name, MonoImage *image, MonoError *error)
@@ -2254,10 +2254,9 @@ mono_reflection_type_from_name_checked (char *name, MonoImage *image, MonoError
        return type;
 }
 
-/*
+/**
  * mono_reflection_get_token:
- *
- *   Return the metadata token of OBJ which should be an object
+ * \returns the metadata token of \p obj which should be an object
  * representing a metadata element.
  */
 guint32
@@ -2273,11 +2272,10 @@ mono_reflection_get_token (MonoObject *obj_raw)
 
 /**
  * mono_reflection_get_token_checked:
- * @obj: the object
- * @error: set on error
- *
- *   Return the metadata token of @obj which should be an object
- * representing a metadata element.  On failure sets @error.
+ * \param obj the object
+ * \param error set on error
+ * \returns the metadata token of \p obj which should be an object
+ * representing a metadata element.  On failure sets \p error.
  */
 guint32
 mono_reflection_get_token_checked (MonoObjectHandle obj, MonoError *error)
@@ -2304,7 +2302,7 @@ mono_reflection_get_token_checked (MonoObjectHandle obj, MonoError *error)
                MonoReflectionTypeBuilderHandle tb = MONO_HANDLE_CAST (MonoReflectionTypeBuilder, obj);
                token = MONO_HANDLE_GETVAL (tb, table_idx) | MONO_TOKEN_TYPE_DEF;
        } else if (strcmp (klass->name, "RuntimeType") == 0) {
-               MonoType *type = mono_reflection_type_get_handle (MONO_HANDLE_RAW (MONO_HANDLE_CAST (MonoReflectionType, obj)), error); /* FIXME use handles */
+               MonoType *type = mono_reflection_type_handle_mono_type (MONO_HANDLE_CAST (MonoReflectionType, obj), error);
                return_val_if_nok (error, 0);
                MonoClass *mc = mono_class_from_mono_type (type);
                if (!mono_class_init (mc)) {
@@ -2369,13 +2367,12 @@ mono_reflection_is_usertype (MonoReflectionTypeHandle ref)
 
 /**
  * mono_reflection_bind_generic_parameters:
- * @type: a managed type object (which should be some kind of generic (instance? definition?))
- * @type_args: the number of type arguments to bind
- * @types: array of type arguments
- * @error: set on error
- *
+ * \param type a managed type object (which should be some kind of generic (instance? definition?))
+ * \param type_args the number of type arguments to bind
+ * \param types array of type arguments
+ * \param error set on error
  * Given a managed type object for a generic type instance, binds each of its arguments to the specified types.
- * Returns the MonoType* for the resulting type instantiation.  On failure returns NULL and sets @error.
+ * \returns the \c MonoType* for the resulting type instantiation.  On failure returns NULL and sets \p error.
  */
 MonoType*
 mono_reflection_bind_generic_parameters (MonoReflectionTypeHandle reftype, int type_argc, MonoType **types, MonoError *error)
@@ -2589,14 +2586,13 @@ mono_declsec_get_flags (MonoImage *image, guint32 token)
        return result;
 }
 
-/*
+/**
+ * mono_declsec_flags_from_method:
+ * \param method The method for which we want the declarative security flags.
  * Get the security actions (in the form of flags) associated with the specified method.
- *
- * @method: The method for which we want the declarative security flags.
- * Return the declarative security flags for the method (only).
- *
- * Note: To keep MonoMethod size down we do not cache the declarative security flags
- *       (except for the stack modifiers which are kept in the MonoJitInfo structure)
+ * To keep \c MonoMethod size down we do not cache the declarative security flags
+ * (except for the stack modifiers which are kept in the MonoJitInfo structure)
+ * \returns the declarative security flags for the method (only).
  */
 guint32
 mono_declsec_flags_from_method (MonoMethod *method)
@@ -2611,14 +2607,13 @@ mono_declsec_flags_from_method (MonoMethod *method)
        return 0;
 }
 
-/*
+/**
+ * mono_declsec_flags_from_class:
+ * \param klass The class for which we want the declarative security flags.
  * Get the security actions (in the form of flags) associated with the specified class.
- *
- * @klass: The class for which we want the declarative security flags.
- * Return the declarative security flags for the class.
- *
- * Note: We cache the flags inside the MonoClass structure as this will get 
- *       called very often (at least for each method).
+ * We cache the flags inside the \c MonoClass structure as this will get 
+ * called very often (at least for each method).
+ * \returns the declarative security flags for the class.
  */
 guint32
 mono_declsec_flags_from_class (MonoClass *klass)
@@ -2641,11 +2636,11 @@ mono_declsec_flags_from_class (MonoClass *klass)
        return 0;
 }
 
-/*
+/**
+ * mono_declsec_flags_from_assembly:
+ * \param assembly The assembly for which we want the declarative security flags.
  * Get the security actions (in the form of flags) associated with the specified assembly.
- *
- * @assembly: The assembly for which we want the declarative security flags.
- * Return the declarative security flags for the assembly.
+ * \returns the declarative security flags for the assembly.
  */
 guint32
 mono_declsec_flags_from_assembly (MonoAssembly *assembly)
@@ -2731,10 +2726,11 @@ mono_declsec_get_method_demands_params (MonoMethod *method, MonoDeclSecurityActi
        return fill_actions_from_index (method->klass->image, idx, demands, id_std, id_noncas, id_choice);
 }
 
-/*
+/**
+ * mono_declsec_get_demands:
  * Collect all actions (that requires to generate code in mini) assigned for
  * the specified method.
- * Note: Don't use the content of actions if the function return FALSE.
+ * Don't use the content of actions if the function return FALSE.
  */
 MonoBoolean
 mono_declsec_get_demands (MonoMethod *method, MonoDeclSecurityActions* demands)
@@ -2781,10 +2777,10 @@ mono_declsec_get_demands (MonoMethod *method, MonoDeclSecurityActions* demands)
 }
 
 
-/*
- * Collect all Link actions: LinkDemand, NonCasLinkDemand and LinkDemandChoice (2.0).
- *
- * Note: Don't use the content of actions if the function return FALSE.
+/**
+ * mono_declsec_get_linkdemands:
+ * Collect all Link actions: \c LinkDemand, \c NonCasLinkDemand and \c LinkDemandChoice (2.0).
+ * Don't use the content of actions if the function return FALSE.
  */
 MonoBoolean
 mono_declsec_get_linkdemands (MonoMethod *method, MonoDeclSecurityActions* klass, MonoDeclSecurityActions *cmethod)
@@ -2827,14 +2823,13 @@ mono_declsec_get_linkdemands (MonoMethod *method, MonoDeclSecurityActions* klass
        return result;
 }
 
-/*
- * Collect all Inherit actions: InheritanceDemand, NonCasInheritanceDemand and InheritanceDemandChoice (2.0).
- *
- * @klass      The inherited class - this is the class that provides the security check (attributes)
- * @demans     
- * return TRUE if inheritance demands (any kind) are present, FALSE otherwise.
- * 
- * Note: Don't use the content of actions if the function return FALSE.
+/**
+ * mono_declsec_get_inheritdemands_class:
+ * \param klass        The inherited class - this is the class that provides the security check (attributes)
+ * \param demands
+ * Collect all Inherit actions - \c InheritanceDemand, \c NonCasInheritanceDemand and \c InheritanceDemandChoice (2.0).
+ * Don't use the content of actions if the function return FALSE.
+ * \returns TRUE if inheritance demands (any kind) are present, FALSE otherwise.
  */
 MonoBoolean
 mono_declsec_get_inheritdemands_class (MonoClass *klass, MonoDeclSecurityActions* demands)
@@ -2859,10 +2854,10 @@ mono_declsec_get_inheritdemands_class (MonoClass *klass, MonoDeclSecurityActions
        return result;
 }
 
-/*
- * Collect all Inherit actions: InheritanceDemand, NonCasInheritanceDemand and InheritanceDemandChoice (2.0).
- *
- * Note: Don't use the content of actions if the function return FALSE.
+/**
+ * mono_declsec_get_inheritdemands_method:
+ * Collect all Inherit actions: \c InheritanceDemand, \c NonCasInheritanceDemand and \c InheritanceDemandChoice (2.0).
+ * Don't use the content of actions if the function return FALSE.
  */
 MonoBoolean
 mono_declsec_get_inheritdemands_method (MonoMethod *method, MonoDeclSecurityActions* demands)
@@ -2931,6 +2926,9 @@ mono_declsec_get_method_action (MonoMethod *method, guint32 action, MonoDeclSecu
        return FALSE;
 }
 
+/**
+ * mono_declsec_get_class_action:
+ */
 MonoBoolean
 mono_declsec_get_class_action (MonoClass *klass, guint32 action, MonoDeclSecurityEntry *entry)
 {
@@ -2945,6 +2943,9 @@ mono_declsec_get_class_action (MonoClass *klass, guint32 action, MonoDeclSecurit
        return FALSE;
 }
 
+/**
+ * mono_declsec_get_assembly_action:
+ */
 MonoBoolean
 mono_declsec_get_assembly_action (MonoAssembly *assembly, guint32 action, MonoDeclSecurityEntry *entry)
 {
@@ -2991,9 +2992,8 @@ mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass, Mono
 
 /**
  * mono_reflection_type_get_type:
- * @reftype: the System.Type object
- *
- * Returns the MonoType* associated with the C# System.Type object @reftype.
+ * \param reftype the \c System.Type object
+ * \returns the \c MonoType* associated with the C# \c System.Type object \p reftype.
  */
 MonoType*
 mono_reflection_type_get_type (MonoReflectionType *reftype)
@@ -3008,9 +3008,8 @@ mono_reflection_type_get_type (MonoReflectionType *reftype)
 
 /**
  * mono_reflection_assembly_get_assembly:
- * @refassembly: the System.Reflection.Assembly object
- *
- * Returns the MonoAssembly* associated with the C# System.Reflection.Assembly object @refassembly.
+ * \param refassembly the \c System.Reflection.Assembly object
+ * \returns the \c MonoAssembly* associated with the C# \c System.Reflection.Assembly object \p refassembly.
  */
 MonoAssembly*
 mono_reflection_assembly_get_assembly (MonoReflectionAssembly *refassembly)
@@ -3022,9 +3021,8 @@ mono_reflection_assembly_get_assembly (MonoReflectionAssembly *refassembly)
 
 /**
  * mono_class_from_mono_type_handle:
- * @reftype: the System.Type handle
- *
- * Returns the MonoClass* corresponding to the given type.
+ * \param reftype the \c System.Type handle
+ * \returns the \c MonoClass* corresponding to the given type.
  */
 MonoClass*
 mono_class_from_mono_type_handle (MonoReflectionTypeHandle reftype)