Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -6,26 +6,15 @@ thisdir := mcs
SUBDIRS :=
include ../build/rules.make
PROGRAM = mcs.exe
EXTRA_DISTFILES = \
mcs.csproj \
mcs.sln \
cs-parser.jay \
mcs.exe.sources
ifeq (basic, $(PROFILE))
LOCAL_MCS_FLAGS += -r:System.dll -r:System.Core.dll -r:System.Xml.dll -debug
PROGRAM = basic.exe
sourcefile = mcs.exe.sources
else
LIB_REFS = System System.Core System.Xml
PROGRAM_USE_INTERMEDIATE_FILE = true
PROGRAM = mcs.exe
the_libdir = $(topdir)/class/lib/build/
LOCAL_MCS_FLAGS += -debug
endif
LIB_REFS = System.Core System.Xml System
LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE
ifndef NO_THREAD_ABORT
@@ -38,10 +27,6 @@ endif
LOCAL_MCS_FLAGS += $(REFERENCE_SOURCES_FLAGS)
PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/4.5
PROGRAM_COMPILE = $(BOOT_COMPILE)
BUILT_SOURCES = cs-parser.cs
CLEAN_FILES += y.output

View File

@@ -1289,7 +1289,9 @@ namespace Mono.CSharp
i = loaded.FindIndex (l => l.Item2 == ca);
}
loaded.RemoveAt (i);
if (i >= 0)
loaded.RemoveAt (i);
break;
}
}

View File

@@ -478,7 +478,7 @@ namespace Mono.CSharp {
catch
{
ec.Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'",
GetValue ().ToString (), target.GetSignatureForError ());
GetValueAsLiteral (), target.GetSignatureForError ());
}
}
@@ -1697,7 +1697,7 @@ namespace Mono.CSharp {
public override string GetValueAsLiteral ()
{
return Value.ToString ();
return Value.ToString (CultureInfo.InvariantCulture);
}
public override long GetValueAsLong ()
@@ -1820,7 +1820,7 @@ namespace Mono.CSharp {
public override string GetValueAsLiteral ()
{
return Value.ToString ();
return Value.ToString (CultureInfo.InvariantCulture);
}
public override long GetValueAsLong ()
@@ -2021,7 +2021,7 @@ namespace Mono.CSharp {
public override string GetValueAsLiteral ()
{
return Value.ToString () + "M";
return Value.ToString (CultureInfo.InvariantCulture) + "M";
}
public override long GetValueAsLong ()

View File

@@ -674,13 +674,13 @@ namespace Mono.CSharp
if (all_source_files == null) {
all_source_files = new Dictionary<string, SourceFile> ();
foreach (var source in SourceFiles)
all_source_files[source.FullPathName] = source;
all_source_files[source.OriginalFullPathName] = source;
}
string path;
if (!Path.IsPathRooted (name)) {
var loc = comp_unit.SourceFile;
string root = Path.GetDirectoryName (loc.FullPathName);
string root = Path.GetDirectoryName (loc.OriginalFullPathName);
path = Path.GetFullPath (Path.Combine (root, name));
var dir = Path.GetDirectoryName (loc.Name);
if (!string.IsNullOrEmpty (dir))

View File

@@ -1 +1 @@
39ee29f1c5df056194e1d3f7e14c8e2577c863cd
8475a9e489428c0d98d91267b7b40954a54be3c2

View File

@@ -257,7 +257,8 @@ namespace Mono.CSharp
Report.Error (625, Location, "`{0}': Instance field types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute", GetSignatureForError ());
}
ConstraintChecker.Check (this, member_type, type_expr.Location);
if (!IsCompilerGenerated)
ConstraintChecker.Check (this, member_type, type_expr.Location);
base.Emit ();
}

View File

@@ -3159,7 +3159,7 @@ namespace Mono.CSharp {
var ga_u = u.TypeArguments;
var ga_v = v.TypeArguments;
if (u.TypeArguments.Length != u.TypeArguments.Length)
if (u.TypeArguments.Length != v.TypeArguments.Length)
return 0;
int score = 0;

View File

@@ -583,7 +583,7 @@ namespace Mono.CSharp
compiler.TimeReporter.Start (TimeReporter.TimerType.ReferencesImporting);
if (corlib == null) {
if (corlib == null || corlib.__IsMissing) {
// System.Object was not found in any referenced assembly, use compiled assembly as corlib
corlib = module.DeclaringAssembly.Builder;
} else {

View File

@@ -15,6 +15,7 @@ using System.Collections.Generic;
using Mono.CompilerServices.SymbolWriter;
using System.Diagnostics;
using System.Linq;
using System.IO;
namespace Mono.CSharp
{
@@ -55,7 +56,7 @@ namespace Mono.CSharp
static readonly byte[] MD5Algorith = { 96, 166, 110, 64, 207, 100, 130, 76, 182, 240, 66, 212, 129, 114, 167, 153 };
public readonly string Name;
public readonly string FullPathName;
public readonly string OriginalFullPathName;
public readonly int Index;
public bool AutoGenerated;
@@ -67,7 +68,7 @@ namespace Mono.CSharp
{
this.Index = index;
this.Name = name;
this.FullPathName = path;
this.OriginalFullPathName = path;
}
public byte[] Checksum {
@@ -99,21 +100,43 @@ namespace Mono.CSharp
this.checksum = checksum;
}
public SourceFileEntry CreateSymbolInfo (MonoSymbolFile symwriter)
public SourceFileEntry CreateSymbolInfo (MonoSymbolFile symwriter, List<KeyValuePair<string, string>> pathMap)
{
if (hidden_lines != null)
hidden_lines.Sort ();
file = new SourceFileEntry (symwriter, FullPathName, algGuid, checksum);
file = new SourceFileEntry (symwriter, GetFullPathName (pathMap), OriginalFullPathName, algGuid, checksum);
if (AutoGenerated)
file.SetAutoGenerated ();
return file;
}
public string GetFullPathName (List<KeyValuePair<string, string>> pathMap)
{
var path = OriginalFullPathName;
if (pathMap != null) {
foreach (var map in pathMap) {
var prefix = map.Key;
if (path.Length <= prefix.Length)
continue;
if (path [prefix.Length] != Path.DirectorySeparatorChar)
continue;
if (!path.StartsWith (prefix, StringComparison.Ordinal))
continue;
path = map.Value + path.Substring (prefix.Length);
}
}
return path;
}
public bool Equals (SourceFile other)
{
return FullPathName == other.FullPathName;
return OriginalFullPathName == other.OriginalFullPathName;
}
public bool IsHiddenLocation (Location loc)
@@ -142,7 +165,7 @@ namespace Mono.CSharp
public override string ToString ()
{
return String.Format ("SourceFile ({0}:{1}:{2})", Name, FullPathName, Index);
return String.Format ("SourceFile ({0}:{1}:{2})", Name, OriginalFullPathName, Index);
}
}
@@ -326,10 +349,10 @@ namespace Mono.CSharp
public string NameFullPath {
get {
int index = File;
if (token == 0 || index <= 0)
if (index <= 0)
return null;
return source_list[index - 1].FullPathName;
return source_list[index - 1].OriginalFullPathName;
}
}
@@ -369,18 +392,6 @@ if (checkpoints.Length <= CheckpointIndex) throw new Exception (String.Format ("
}
}
// The ISymbolDocumentWriter interface is used by the symbol writer to
// describe a single source file - for each source file there's exactly
// one corresponding ISymbolDocumentWriter instance.
//
// This class has an internal hash table mapping source document names
// to such ISymbolDocumentWriter instances - so there's exactly one
// instance per document.
//
// This property returns the ISymbolDocumentWriter instance which belongs
// to the location's source file.
//
// If we don't have a symbol writer, this property is always null.
public SourceFile SourceFile {
get {
int index = File;

View File

@@ -1024,6 +1024,7 @@ namespace Mono.CSharp {
shared_list = false;
prev = new List<MemberSpec> (found.Count + 1);
prev.AddRange (found);
found = prev;
} else {
prev = (List<MemberSpec>) found;
}

View File

@@ -723,7 +723,12 @@ namespace Mono.CSharp {
}
}
if (type_expr != null)
//
// Optimization but it also covers cases where we cannot check
// constraints because method is captured into generated class
// and type parameters context is now different
//
if (type_expr != null && !IsCompilerGenerated)
ConstraintChecker.Check (this, member_type, type_expr.Location);
base.Emit ();

View File

@@ -624,8 +624,8 @@ namespace Mono.CSharp {
if (include_files == null)
include_files = new Dictionary<string, SourceFile> ();
if (!include_files.ContainsKey (file.FullPathName))
include_files.Add (file.FullPathName, file);
if (!include_files.ContainsKey (file.OriginalFullPathName))
include_files.Add (file.OriginalFullPathName, file);
}
public void AddDefine (string value)
@@ -648,7 +648,7 @@ namespace Mono.CSharp {
{
var sw = Module.DeclaringAssembly.SymbolWriter;
if (sw != null) {
CreateUnitSymbolInfo (sw);
CreateUnitSymbolInfo (sw, Compiler.Settings.PathMap);
}
base.PrepareEmit ();
@@ -657,14 +657,14 @@ namespace Mono.CSharp {
//
// Creates symbol file index in debug symbol file
//
void CreateUnitSymbolInfo (MonoSymbolFile symwriter)
void CreateUnitSymbolInfo (MonoSymbolFile symwriter, List<KeyValuePair<string, string>> pathMap)
{
var si = file.CreateSymbolInfo (symwriter);
var si = file.CreateSymbolInfo (symwriter, pathMap);
comp_unit = new CompileUnitEntry (symwriter, si);
if (include_files != null) {
foreach (SourceFile include in include_files.Values) {
si = include.CreateSymbolInfo (symwriter);
si = include.CreateSymbolInfo (symwriter, pathMap);
comp_unit.AddFile (si);
}
}

View File

@@ -1210,7 +1210,7 @@ namespace Mono.CSharp.Nullable
//
// Special case null ?? null
//
if (right.IsNull && ltype == right.Type)
if (right is NullLiteral && ltype == right.Type)
return null;
return ReducedExpression.Create (lc != null ? right : left, this, false);

View File

@@ -87,6 +87,8 @@ namespace Mono.CSharp {
//
public List<Tuple<string, string>> AssemblyReferencesAliases;
public List<KeyValuePair<string, string>> PathMap;
//
// Modules to be embedded
//
@@ -932,7 +934,7 @@ namespace Mono.CSharp {
return ParseResult.Success;
case "/debug":
if (value.Equals ("full", StringComparison.OrdinalIgnoreCase) || value.Equals ("pdbonly", StringComparison.OrdinalIgnoreCase) || idx < 0) {
if (value.Equals ("full", StringComparison.OrdinalIgnoreCase) || value.Equals ("pdbonly", StringComparison.OrdinalIgnoreCase) || value.Equals ("portable", StringComparison.OrdinalIgnoreCase) || idx < 0) {
settings.GenerateDebugInfo = true;
return ParseResult.Success;
}
@@ -1204,6 +1206,31 @@ namespace Mono.CSharp {
settings.RuntimeMetadataVersion = value;
return ParseResult.Success;
case "/pathmap":
if (value.Length == 0) {
return ParseResult.Success;
}
foreach (var pair in value.Split (',')) {
var kv = pair.Split ('=');
if (kv.Length != 2) {
report.Error (8101, "The pathmap option was incorrectly formatted");
return ParseResult.Error;
}
if (settings.PathMap == null)
settings.PathMap = new List<KeyValuePair<string, string>> ();
var key = kv [0].TrimEnd (Path.DirectorySeparatorChar);
var path = kv [1].TrimEnd (Path.DirectorySeparatorChar);
if (key.Length == 0 || path.Length == 0)
report.Error (8101, "The pathmap option was incorrectly formatted");
settings.PathMap.Add (new KeyValuePair<string, string> (key, path));
}
return ParseResult.Success;
// csc options that we don't support
case "/analyzer":
case "/appconfig":
@@ -1220,7 +1247,6 @@ namespace Mono.CSharp {
case "/link":
case "/moduleassemblyname":
case "/nowin32manifest":
case "/pathmap":
case "/pdb":
case "/preferreduilang":
case "/publicsign":
@@ -1591,7 +1617,7 @@ namespace Mono.CSharp {
" -help Lists all compiler options (short: -?)\n" +
" -keycontainer:NAME The key pair container used to sign the output assembly\n" +
" -keyfile:FILE The key file used to strongname the ouput assembly\n" +
" -langversion:TEXT Specifies language version: ISO-1, ISO-2, 3, 4, 5, Default or Experimental\n" +
" -langversion:TEXT Specifies language version: ISO-1, ISO-2, 3, 4, 5, 6, Default or Experimental\n" +
" -lib:PATH1[,PATHn] Specifies the location of referenced assemblies\n" +
" -main:CLASS Specifies the class with the Main method (short: -m)\n" +
" -noconfig Disables implicitly referenced assemblies\n" +
@@ -1599,6 +1625,7 @@ namespace Mono.CSharp {
" -nowarn:W1[,Wn] Suppress one or more compiler warnings\n" +
" -optimize[+|-] Enables advanced compiler optimizations (short: -o)\n" +
" -out:FILE Specifies output assembly name\n" +
" -pathmap:K=V[,Kn=Vn] Sets a mapping for source path names used in generated output\n" +
" -pkg:P1[,Pn] References packages P1..Pn\n" +
" -platform:ARCH Specifies the target platform of the output assembly\n" +
" ARCH can be one of: anycpu, anycpu32bitpreferred, arm,\n" +

View File

@@ -1 +1 @@
75f2b8ed1eb8e49031e9eb5ff5c370c01a61e4e9
fbb060f52960da9af8218171c9cf6991e8b102cc