diff options
author | Marek Safar <marek.safar@gmail.com> | 2017-08-29 17:23:00 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-08-29 20:51:08 +0300 |
commit | 50490aaa7f5e987e02a82f0b4c0bcf8f2ebc60d0 (patch) | |
tree | 515d527c49d7c66d7ffb1b00a21eb5fd5bb165a0 /mcs/ilasm | |
parent | 0290d19c8391ff5a16fe32a073221f34245afc5d (diff) |
[ilasm] Adds noautoinherit option
Diffstat (limited to 'mcs/ilasm')
-rw-r--r-- | mcs/ilasm/Driver.cs | 15 | ||||
-rw-r--r-- | mcs/ilasm/codegen/CodeGen.cs | 8 | ||||
-rw-r--r-- | mcs/ilasm/codegen/TypeDef.cs | 4 | ||||
-rw-r--r-- | mcs/ilasm/ilasm.csproj | 2 |
4 files changed, 19 insertions, 10 deletions
diff --git a/mcs/ilasm/Driver.cs b/mcs/ilasm/Driver.cs index af7120dce58..fc2e213bc87 100644 --- a/mcs/ilasm/Driver.cs +++ b/mcs/ilasm/Driver.cs @@ -53,6 +53,7 @@ namespace Mono.ILASM { private bool keycontainer = false; private string keyname; private StrongName sn; + bool noautoinherit; public DriverMain (string[] args) { @@ -67,7 +68,7 @@ namespace Mono.ILASM { if (output_file == null) output_file = CreateOutputFilename (); try { - codegen = new CodeGen (output_file, target == Target.Dll, debugging_info); + codegen = new CodeGen (output_file, target == Target.Dll, debugging_info, noautoinherit); foreach (string file_path in il_file_list) { Report.FilePath = file_path; ProcessFile (file_path); @@ -270,6 +271,9 @@ namespace Mono.ILASM { else keyname = command_arg; break; + case "noautoinherit": + noautoinherit = true; + break; case "scan_only": scan_only = true; break; @@ -336,16 +340,17 @@ namespace Mono.ILASM { private void Usage () { - Console.WriteLine ("Mono ILasm compiler\n" + + Console.WriteLine ("Mono IL assembler compiler\n" + "ilasm [options] source-files\n" + - " --about About the Mono ILasm compiler\n" + - " --version Print the version number of the Mono ILasm compiler\n" + + " --about About the Mono IL assembler compiler\n" + + " --version Print the version number of the compiler\n" + " /output:file_name Specifies output file.\n" + " /exe Compile to executable.\n" + " /dll Compile to library.\n" + " /debug Include debug information.\n" + " /key:keyfile Strongname using the specified key file\n" + " /key:@container Strongname using the specified key container\n" + + " /noautoinherit Disable inheriting from System.Object by default\n" + "Options can be of the form -option or /option\n"); Environment.Exit (1); } @@ -361,7 +366,7 @@ namespace Mono.ILASM { private void Version () { string version = System.Reflection.Assembly.GetExecutingAssembly ().GetName ().Version.ToString (); - Console.WriteLine ("Mono ILasm compiler version {0}", version); + Console.WriteLine ("Mono IL assembler compiler version {0}", version); Environment.Exit (0); } diff --git a/mcs/ilasm/codegen/CodeGen.cs b/mcs/ilasm/codegen/CodeGen.cs index 6b9aadfc80e..1d9ebe4b1cc 100644 --- a/mcs/ilasm/codegen/CodeGen.cs +++ b/mcs/ilasm/codegen/CodeGen.cs @@ -63,14 +63,16 @@ namespace Mono.ILASM { private string output_file;
private bool is_dll;
private bool entry_point;
+ bool noautoinherit;
private Module this_module;
- public CodeGen (string output_file, bool is_dll, bool debugging_info)
+ public CodeGen (string output_file, bool is_dll, bool debugging_info, bool noautoinherit)
{
this.output_file = output_file;
this.is_dll = is_dll;
-
+ this.noautoinherit = noautoinherit;
+
if (debugging_info)
symwriter = new SymbolWriter (output_file);
@@ -313,7 +315,7 @@ namespace Mono.ILASM { typedef = new TypeDef (attr, current_namespace,
name, parent, impl_list, location, gen_params, outer);
-
+ typedef.NoAutoInherit = noautoinherit && parent == null;
type_manager[cache_name] = typedef;
current_customattrtarget = current_typedef = typedef;
current_declsectarget = typedef;
diff --git a/mcs/ilasm/codegen/TypeDef.cs b/mcs/ilasm/codegen/TypeDef.cs index 74200cddf49..f35dca0bd4a 100644 --- a/mcs/ilasm/codegen/TypeDef.cs +++ b/mcs/ilasm/codegen/TypeDef.cs @@ -93,6 +93,8 @@ namespace Mono.ILASM { this.attr |= PEAPI.TypeAttr.Abstract; } + public bool NoAutoInherit { get; set; } + public string Name { get { return name; } } @@ -389,7 +391,7 @@ namespace Mono.ILASM { name_space, name); } } - if (FullName == "System.Object") + if (FullName == "System.Object" || NoAutoInherit) classdef.SpecialNoSuper (); } diff --git a/mcs/ilasm/ilasm.csproj b/mcs/ilasm/ilasm.csproj index 4c2a6cfd26d..a72cd9f0060 100644 --- a/mcs/ilasm/ilasm.csproj +++ b/mcs/ilasm/ilasm.csproj @@ -35,7 +35,7 @@ <ItemGroup> <Reference Include="System" /> <Reference Include="PEAPI"> - <HintPath>..\class\lib\net_4_5\PEAPI.dll</HintPath> + <HintPath>..\class\lib\net_4_x\PEAPI.dll</HintPath> </Reference> <Reference Include="Mono.CompilerServices.SymbolWriter" /> <Reference Include="Mono.Security" /> |