Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/tools
diff options
context:
space:
mode:
authorJb Evain <jbevain@gmail.com>2010-01-14 21:12:41 +0300
committerJb Evain <jbevain@gmail.com>2010-01-14 21:12:41 +0300
commit59887d8819ae792736db548190570fa938b6b9ec (patch)
treef56fcfb18b42117aefa3fc61b9675f86335fe246 /mcs/tools
parent585a395a95d0cc93fe83bcac2bd76e48ddff53eb (diff)
2010-01-14 Jb Evain <jbevain@novell.com>
* MarkStep.cs: preserve fields specified by the SoapHeader attribute. backport r149571. svn path=/branches/mono-2-6/mcs/; revision=149572
Diffstat (limited to 'mcs/tools')
-rw-r--r--mcs/tools/linker/ChangeLog7
-rw-r--r--mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs67
2 files changed, 62 insertions, 12 deletions
diff --git a/mcs/tools/linker/ChangeLog b/mcs/tools/linker/ChangeLog
index 8519d5371d4..845cc068007 100644
--- a/mcs/tools/linker/ChangeLog
+++ b/mcs/tools/linker/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-14 Jb Evain <jbevain@novell.com>
+
+ * MarkStep.cs: preserve fields specified by the
+ SoapHeader attribute.
+
+ backport r149571.
+
2010-01-13 Jb Evain <jbevain@novell.com>
* MarkStep.cs: preserve methods specified by the
diff --git a/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs b/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs
index 9e8235b6e40..3ac2e260051 100644
--- a/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs
+++ b/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs
@@ -385,7 +385,7 @@ namespace Mono.Linker.Steps {
MarkMethodsIf (type.Constructors, IsSpecialSerializationConstructorPredicate);
}
- MarkXmlSchemaProvider (type);
+ MarkTypeSpecialCustomAttributes (type);
MarkGenericParameterProvider (type);
@@ -408,31 +408,55 @@ namespace Mono.Linker.Steps {
ApplyPreserveInfo (type);
}
- void MarkXmlSchemaProvider (TypeDefinition type)
+ void MarkTypeSpecialCustomAttributes (TypeDefinition type)
{
if (!type.HasCustomAttributes)
return;
foreach (CustomAttribute attribute in type.CustomAttributes) {
- if (!IsXmlSchemaProvider (attribute))
- continue;
-
- MarkXmlSchemaProvider (type, attribute);
+ switch (attribute.Constructor.DeclaringType.FullName) {
+ case "System.Xml.Serialization.XmlSchemaProviderAttribute":
+ MarkXmlSchemaProvider (type, attribute);
+ break;
+ }
}
}
- void MarkXmlSchemaProvider (TypeDefinition type, CustomAttribute attribute)
+ void MarkMethodSpecialCustomAttributes (MethodDefinition method)
{
- if (!attribute.Resolved || attribute.ConstructorParameters.Count < 1)
+ if (!method.HasCustomAttributes)
return;
- var method_name = attribute.ConstructorParameters [0] as string;
- if (method_name == null)
+ foreach (CustomAttribute attribute in method.CustomAttributes) {
+ switch (attribute.Constructor.DeclaringType.FullName) {
+ case "System.Web.Services.Protocols.SoapHeaderAttribute":
+ MarkSoapHeader (method, attribute);
+ break;
+ }
+ }
+ }
+
+ void MarkXmlSchemaProvider (TypeDefinition type, CustomAttribute attribute)
+ {
+ string method_name;
+ if (!TryGetStringArgument (attribute, out method_name))
return;
MarkNamedMethod (type, method_name);
}
+ static bool TryGetStringArgument (CustomAttribute attribute, out string argument)
+ {
+ argument = null;
+
+ if (!attribute.Resolved || attribute.ConstructorParameters.Count < 1)
+ return false;
+
+ argument = attribute.ConstructorParameters [0] as string;
+
+ return argument != null;
+ }
+
void MarkNamedMethod (TypeDefinition type, string method_name)
{
if (!type.HasMethods)
@@ -446,9 +470,26 @@ namespace Mono.Linker.Steps {
}
}
- static bool IsXmlSchemaProvider (CustomAttribute attribute)
+ void MarkSoapHeader (MethodDefinition method, CustomAttribute attribute)
+ {
+ string field_name;
+ if (!TryGetStringArgument (attribute, out field_name))
+ return;
+
+ MarkNamedField (method.DeclaringType, field_name);
+ }
+
+ void MarkNamedField (TypeDefinition type, string field_name)
{
- return attribute.Constructor.DeclaringType.FullName == "System.Xml.Serialization.XmlSchemaProviderAttribute";
+ if (!type.HasFields)
+ return;
+
+ foreach (FieldDefinition field in type.Fields) {
+ if (field.Name != field_name)
+ continue;
+
+ MarkField (field);
+ }
}
void MarkGenericParameterProvider (IGenericParameterProvider provider)
@@ -754,6 +795,8 @@ namespace Mono.Linker.Steps {
MarkMethod (ov);
}
+ MarkMethodSpecialCustomAttributes (method);
+
if (method.IsVirtual)
_virtual_methods.Add (method);