Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7b57680
Fix SimpleDiagnostic GetHashCode is more specific than Equals
pdelvo Feb 3, 2015
3a54c09
Create new projects for System.Runtime.Analyzers
srivatsn Feb 7, 2015
9064193
The guids for the new analyzer projects were copied from the codeanal…
srivatsn Feb 10, 2015
b658905
Merge remote-tracking branch 'upstream/master' into splitfxcop
srivatsn Feb 10, 2015
0443425
Fixes #309
pharring Feb 10, 2015
b0b6e70
properly handle VB Global namespace in DeclaredSymbolInfo
brettfo Feb 10, 2015
62b42e5
Merge branch 'master' into getnodename
brettfo Feb 10, 2015
9e9302a
Merge changes with upstream/master - Roslyn.sln needed merging since …
srivatsn Feb 10, 2015
3d5ba30
Merge remote-tracking branch 'upstream/master' into IncrementalBuildFix
pharring Feb 10, 2015
e720a2d
Incorporate review feedback
pharring Feb 10, 2015
13d27f3
Merge pull request #371 from pharring/IncrementalBuildFix
pharring Feb 11, 2015
2189fa0
Move MetadataReaderPdbExtensions.cs to compilers, the writer needs it…
tmat Feb 11, 2015
6cdf94b
Substitute generic type arguments for generic frames in the Call Stac…
KevinH-MS Feb 10, 2015
e4dbbc2
remove dead code
heejaechang Feb 11, 2015
7019fa3
Merge pull request #352 from KevinH-MS/master
KevinH-MS Feb 11, 2015
5c20919
Fix RunTests
jaredpar Feb 11, 2015
7a9f10c
Merge pull request #393 from heejaechang/removeDeadCode
Feb 11, 2015
31e3e2e
Merge pull request #338 from srivatsn/splitfxcop
srivatsn Feb 11, 2015
b73a4fa
Add filter to NavigableItemFactory.DeclaredSymbolNavigableItem._lazyD…
tmat Feb 11, 2015
40b7ea3
Add skipped test for https://github.com/dotnet/roslyn/issues/320: Pos…
mavasani Feb 11, 2015
d39ebbf
Merge remote-tracking branch 'upstream/master' into portable-pdb
tmat Feb 11, 2015
7927dc4
Add documentation of VB root namespace CDI
tmat Feb 11, 2015
aba54ff
Add *.wrn to .gitignore
shyamnamboodiripad Feb 11, 2015
142828d
Merge pull request #209 from pdelvo/fix-57
mavasani Feb 11, 2015
0d32128
Address CR feedback.
mavasani Feb 11, 2015
75abef0
Merge pull request #397 from mavasani/batchfixer_fix3
mavasani Feb 11, 2015
7e6ef64
Merge pull request #402 from shyamnamboodiripad/master
jaredpar Feb 11, 2015
04346bf
Merge pull request #381 from brettfo/getnodename
brettfo Feb 11, 2015
6ba9c7a
Add comments and cleanup method ordinals for additional types; also r…
tmat Feb 11, 2015
999b647
Merge branch 'master' into AdditionalTypes
tmat Feb 11, 2015
fa1b367
Merge remote-tracking branch 'upstream/portable-pdb' into portable-pdb
tmat Feb 11, 2015
b4ca14a
Merge remote-tracking branch 'upstream/master' into portable-pdb
tmat Feb 11, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ UnitTestResults.html
*.tmp
*.tmp_proj
*.log
*.wrn
*.vspscc
*.vssscc
.builds
Expand Down
88 changes: 59 additions & 29 deletions build/VSL.Imports.Closed.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- ====================================================================================

Support for in-place modification of the compiled binary.
Since there may be more than one post compile modification, we must take care not
to break incremental builds. A timestemp file is written out when all modification
targets have completed.
Note that the targets participating in post compile modification must list the
sentinel file as one of their outputs, but they should not modify it.

==================================================================================== -->

<PropertyGroup>
<PostCompileBinaryModificationSentinelFile>$(IntermediateOutputPath)$(TargetFileName).pcbm</PostCompileBinaryModificationSentinelFile>
</PropertyGroup>

<Target Name="PostCompileBinaryModification"
AfterTargets="CoreCompile"
DependsOnTargets="ApplyOptimizations;FakeSign"
Inputs="@(IntermediateAssembly)"
Outputs="@(IntermediateAssembly);$(PostCompileBinaryModificationSentinelFile)">

<!-- Write out a sentinel timestamp file to prevent unnecessary work in incremental builds. -->
<Touch AlwaysCreate="true" Files="$(PostCompileBinaryModificationSentinelFile)" />

<ItemGroup>
<FileWrites Include="$(PostCompileBinaryModificationSentinelFile)" />
</ItemGroup>
</Target>

<!-- ====================================================================================

Support for rolling optimization data into assemblies.
Expand All @@ -13,25 +43,44 @@

<Target Name="ApplyOptimizations"
Condition="'$(Configuration)' == 'Release' AND '$(NonShipping)' != 'true' AND '$(SkipApplyOptimizations)' != 'true' AND Exists('$(OptimizationDataFile)')"
DependsOnTargets="CoreCompile"
Inputs="@(IntermediateAssembly)"
Outputs="@(IntermediateAssembly);@(IntermediateAssembly->'%(RootDir)%(Directory)%(Filename).ibcmerge.timestamp')">
Outputs="@(IntermediateAssembly);$(PostCompileBinaryModificationSentinelFile)">

<Message Text="Adding optimization data to @(IntermediateAssembly)"/>
<Exec Command="&quot;$(IbcMergePath)&quot; -q -f -partialNGEN -minify -mo &quot;@(IntermediateAssembly)&quot; -incremental &quot;$(OptimizationDataFile)&quot;" />

<Message Text="Re-signing after merging optimization data" Condition="'$(DelaySign)' != 'true' AND '$(SignAssembly)' == 'true'" />
<Exec Command="&quot;$(SnToolPath)&quot; -q -R &quot;@(IntermediateAssembly)&quot; &quot;$(AssemblyOriginatorKeyFile)&quot;" Condition="'$(DelaySign)' != 'true' AND '$(SignAssembly)' == 'true'" />

</Target>

<!-- Write out a sentinel timestamp file. Since the rewrite happens in-place, this extra output enables incremental build to work. -->
<Touch AlwaysCreate="true" Files="@(IntermediateAssembly->'%(RootDir)%(Directory)%(Filename).ibcmerge.timestamp')" />
<!-- ====================================================================================

Support for signing files that are in VSIXes.

</Target>
==================================================================================== -->

<Target Name="CleanApplyOptimizations">
<Delete Files="@(IntermediateAssembly->'%(RootDir)%(Directory)%(Filename).ibcmerge.timestamp')" />
<PropertyGroup>
<RunningInMicroBuild Condition="Exists('$(TF_BUILD_BUILDDIRECTORY)\MicroBuild\MicroBuild.Signing.dll')">true</RunningInMicroBuild>
<ShouldSignBuild Condition="'$(RealSignBuild)' == 'true' OR ('$(RunningInMicroBuild)' == 'true' AND '$(SignType)' == 'real')">true</ShouldSignBuild>
</PropertyGroup>

<Target Name="FakeSign"
Condition="'$(DelaySign)' == 'true' AND '$(ShouldSignBuild)' != 'true' AND ('$(Language)' == 'C#' OR '$(Language)' == 'VB')"
Inputs="@(IntermediateAssembly)"
Outputs="@(IntermediateAssembly);$(PostCompileBinaryModificationSentinelFile)">

<Exec Command="$(VSLOutDir)\FakeSign.exe &quot;@(IntermediateAssembly)&quot;" />

</Target>

<!-- ====================================================================================

Support for signing phone assemblies.

==================================================================================== -->
<UsingTask TaskName="SignFiles" AssemblyFile="$(TF_BUILD_BUILDDIRECTORY)\MicroBuild\MicroBuild.Signing.dll" Condition="'$(RunningInMicroBuild)' == 'true'" />

<Target Name="CreateAndSignPhoneCopy"
Condition="'$(NeedsPhoneCopy)' == 'true'"
DependsOnTargets="Compile"
Expand Down Expand Up @@ -63,40 +112,21 @@
</Target>

<PropertyGroup>
<CompileDependsOn>$(CompileDependsOn);ApplyOptimizations</CompileDependsOn>
<CleanDependsOn>$(CleanDependsOn);CleanApplyOptimizations;CleanPhoneCopy</CleanDependsOn>
<CleanDependsOn>$(CleanDependsOn);CleanPhoneCopy</CleanDependsOn>
</PropertyGroup>

<!-- ====================================================================================

Support for signing files that are in VSIXes, and also signing the resulting package
Support for signing VSIXes

==================================================================================== -->

<PropertyGroup>
<RunningInMicroBuild Condition="Exists('$(TF_BUILD_BUILDDIRECTORY)\MicroBuild\MicroBuild.Signing.dll')">true</RunningInMicroBuild>
<ShouldSignBuild Condition="'$(RealSignBuild)' == 'true' OR ('$(RunningInMicroBuild)' == 'true' AND '$(SignType)' == 'real')">true</ShouldSignBuild>
<CompileDependsOn>$(CompileDependsOn);FakeSignAssembly</CompileDependsOn>
<FakeSignSentinelFile>$(IntermediateOutputPath)$(TargetFileName).fakesign</FakeSignSentinelFile>
</PropertyGroup>

<Target Name="FakeSignAssembly"
Condition="'$(DelaySign)' == 'true' AND '$(ShouldSignBuild)' != 'true' AND ('$(Language)' == 'C#' OR '$(Language)' == 'VB')"
DependsOnTargets="CoreCompile"
Inputs="$(IntermediateOutputPath)$(TargetFileName)"
Outputs="$(FakeSignSentinelFile)">
<Exec Command="$(VSLOutDir)\FakeSign.exe &quot;$(IntermediateOutputPath)$(TargetFileName)&quot;" />
<Touch Files="$(FakeSignSentinelFile)" AlwaysCreate="true" />
</Target>

<UsingTask TaskName="SignFiles" AssemblyFile="$(TF_BUILD_BUILDDIRECTORY)\MicroBuild\MicroBuild.Signing.dll" Condition="'$(RunningInMicroBuild)' == 'true'" />

<PropertyGroup>
<CreateVsixContainerDependsOn>$(CreateVsixContainerDependsOn);SignVsixInputs</CreateVsixContainerDependsOn>
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);SignVsix</PrepareForRunDependsOn>
<ProducingSignedVsix Condition="'$(ShouldSignBuild)' == 'true' AND '$(NonShipping)' != 'true' AND '$(CreateVsixContainer)' == 'true'">true</ProducingSignedVsix>
</PropertyGroup>

<!-- GetTargetPath returns the path under $(OutDir) for each project.
This target adds the $(AuthenticodeCertificateName) as metadata. -->
<Target Name="GetTargetPathWithAuthenticodeCertificateName" DependsOnTargets="GetTargetPath" Returns="@(TargetPathWithAuthenticodeCertificateName)">
Expand Down
13 changes: 13 additions & 0 deletions docs/specs/PortablePdb-Metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,19 @@ Structure:

TODO: Bit ordering.

##### Root Namespace (VB compiler)
Parent: Module

Kind: {58b2eab6-209f-4e4e-a22c-b2d0f910c782}

Structure:

Blob ::= namespace

| terminal | encoding | description|
|:---------|:---------|:-----------|
| _namespace_ | UTF8 string | The root namespace. |

##### Edit and Continue Local Slot Map (C# & VB compilers)
Parent: MethodDef

Expand Down
24 changes: 1 addition & 23 deletions src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2283,25 +2283,6 @@ internal override CommonPEModuleBuilder CreateModuleBuilder(
CompilationTestData testData,
DiagnosticBag diagnostics,
CancellationToken cancellationToken)
{
return this.CreateModuleBuilder(
emitOptions,
manifestResources,
assemblySymbolMapper,
testData,
diagnostics,
ImmutableArray<NamedTypeSymbol>.Empty,
cancellationToken);
}

internal CommonPEModuleBuilder CreateModuleBuilder(
EmitOptions emitOptions,
IEnumerable<ResourceDescription> manifestResources,
Func<IAssemblySymbol, AssemblyIdentity> assemblySymbolMapper,
CompilationTestData testData,
DiagnosticBag diagnostics,
ImmutableArray<NamedTypeSymbol> additionalTypes,
CancellationToken cancellationToken)
{
// Do not waste a slot in the submission chain for submissions that contain no executable code
// (they may only contain #r directives, usings, etc.)
Expand All @@ -2326,8 +2307,6 @@ internal CommonPEModuleBuilder CreateModuleBuilder(
PEModuleBuilder moduleBeingBuilt;
if (_options.OutputKind.IsNetModule())
{
Debug.Assert(additionalTypes.IsEmpty);

moduleBeingBuilt = new PENetModuleBuilder(
(SourceModuleSymbol)SourceModule,
emitOptions,
Expand All @@ -2343,8 +2322,7 @@ internal CommonPEModuleBuilder CreateModuleBuilder(
kind,
moduleProps,
manifestResources,
assemblySymbolMapper,
additionalTypes);
assemblySymbolMapper);
}

// testData is only passed when running tests.
Expand Down
5 changes: 3 additions & 2 deletions src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,9 @@ private void CompileSynthesizedMethods(TypeCompilationState compilationState)

AsyncStateMachine stateMachineType;

// In case of async lambdas, the method has already been uniquely named, so there is no need to
// produce a unique method ordinal for the corresponding state machine type, whose name includes the (unique) method name.
// Synthesized methods have no ordinal stored in custom debug information (only user-defined methods have ordinals).
// In case of async lambdas, which synthesize a state machine type during the following rewrite, the containing method has already been uniquely named,
// so there is no need to produce a unique method ordinal for the corresponding state machine type, whose name includes the (unique) containing method name.
const int methodOrdinal = -1;
BoundStatement bodyWithoutAsync = AsyncRewriter.Rewrite(methodWithBody.Body, method, methodOrdinal, variableSlotAllocatorOpt, compilationState, diagnosticsThisMethod, out stateMachineType);

Expand Down
16 changes: 9 additions & 7 deletions src/Compilers/CSharp/Portable/Compiler/TypeCompilationState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ internal MethodWithBody(MethodSymbol method, BoundStatement body, ImportChain im
/// only need one wrapper to call it non-virtually.
/// </summary>
private Dictionary<MethodSymbol, MethodSymbol> _wrappers;

private readonly NamedTypeSymbol _type;

/// <summary>
/// Type symbol being compiled, or null if we compile a synthesized type that doesn't have a symbol (e.g. PrivateImplementationDetails).
/// </summary>
private readonly NamedTypeSymbol _typeOpt;

/// <summary>
/// The builder for generating code, or null if not in emit phase.
Expand All @@ -65,10 +68,10 @@ internal MethodWithBody(MethodSymbol method, BoundStatement body, ImportChain im

public LambdaFrame staticLambdaFrame;

public TypeCompilationState(NamedTypeSymbol type, CSharpCompilation compilation, PEModuleBuilder moduleBuilderOpt)
public TypeCompilationState(NamedTypeSymbol typeOpt, CSharpCompilation compilation, PEModuleBuilder moduleBuilderOpt)
{
this.Compilation = compilation;
_type = type;
_typeOpt = typeOpt;
this.ModuleBuilderOpt = moduleBuilderOpt;
}

Expand All @@ -80,9 +83,8 @@ public NamedTypeSymbol Type
get
{
// NOTE: currently it can be null if only private implementation type methods are compiled
// TODO: is it used? if yes, make sure it is not accessed when type is not available;
Debug.Assert((object)_type != null);
return _type;
Debug.Assert((object)_typeOpt != null);
return _typeOpt;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,8 @@ public PEAssemblyBuilder(
OutputKind outputKind,
ModulePropertiesForSerialization serializationProperties,
IEnumerable<ResourceDescription> manifestResources,
Func<AssemblySymbol, AssemblyIdentity> assemblySymbolMapper = null,
ImmutableArray<NamedTypeSymbol> additionalTypes = default(ImmutableArray<NamedTypeSymbol>))
: base(sourceAssembly, emitOptions, outputKind, serializationProperties, manifestResources, assemblySymbolMapper, additionalTypes)
Func<AssemblySymbol, AssemblyIdentity> assemblySymbolMapper = null)
: base(sourceAssembly, emitOptions, outputKind, serializationProperties, manifestResources, assemblySymbolMapper, ImmutableArray<NamedTypeSymbol>.Empty)
{
}

Expand Down
3 changes: 3 additions & 0 deletions src/Compilers/Core/Portable/CodeAnalysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
<CodeAnalysisRuleSet>..\CodeAnalysisRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\..\Test\PdbUtilities\Metadata\MetadataReaderPdbExtensions.cs">
<Link>MetadataReader\MetadataReaderPdbExtensions.cs</Link>
</Compile>
<Compile Include="Binding\AbstractLookupSymbolsInfo.cs" />
<Compile Include="CaseInsensitiveComparison.cs" />
<Compile Include="CodeAnalysisResources.Designer.cs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ private SimpleDiagnostic(
if ((warningLevel == 0 && severity != DiagnosticSeverity.Error) ||
(warningLevel != 0 && severity == DiagnosticSeverity.Error))
{
throw new ArgumentException("warningLevel");
throw new ArgumentException(nameof(warningLevel));
}

if(descriptor == null)
{
throw new ArgumentNullException(nameof(descriptor));
}

_descriptor = descriptor;
_severity = severity;
_warningLevel = warningLevel;
_location = location;
_location = location ?? Location.None;
_additionalLocations = additionalLocations == null ? SpecializedCollections.EmptyReadOnlyList<Location>() : additionalLocations.ToImmutableArray();
_messageArgs = messageArgs ?? SpecializedCollections.EmptyArray<object>();
}
Expand Down Expand Up @@ -131,10 +136,9 @@ public override bool Equals(object obj)
public override int GetHashCode()
{
return Hash.Combine(_descriptor,
Hash.Combine(_messageArgs.GetHashCode(),
Hash.Combine(_location.GetHashCode(),
Hash.Combine(_severity.GetHashCode(), _warningLevel)
)));
Hash.CombineValues(_messageArgs,
Hash.Combine(_warningLevel,
Hash.Combine(_location, (int)_severity))));
}

internal override Diagnostic WithLocation(Location location)
Expand Down
24 changes: 24 additions & 0 deletions src/Compilers/Core/Portable/InternalUtilities/Hash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,30 @@ internal static int CombineValues<T>(IEnumerable<T> values, int maxItemsToHash =
return hashCode;
}

internal static int CombineValues<T>(T[] values, int maxItemsToHash = int.MaxValue)
{
if (values == null)
{
return 0;
}

var maxSize = Math.Min(maxItemsToHash, values.Length);
var hashCode = 0;

for (int i = 0; i < maxSize; i++)
{
T value = values[i];

// Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible).
if (value != null)
{
hashCode = Hash.Combine(value.GetHashCode(), hashCode);
}
}

return hashCode;
}

internal static int CombineValues<T>(ImmutableArray<T> values, int maxItemsToHash = int.MaxValue)
{
if (values.IsDefaultOrEmpty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Collections;
Expand Down Expand Up @@ -176,20 +177,6 @@ private void PopulateDebugTableRows()

private const int ModuleImportScopeRid = 1;

// TODO: move to mdreader
private enum ImportScopeKind
{
ImportNamespace = 1,
ImportAssemblyNamespace = 2,
ImportType = 3,
ImportXmlNamespace = 4,
ImportAssemblyReferenceAlias = 5,
AliasAssemblyReference = 6,
AliasNamespace = 7,
AliasAssemblyNamespace = 8,
AliasType = 9
}

private void SerializeImport(BinaryWriter writer, AssemblyReferenceAlias alias)
{
// <import> ::= AliasAssemblyReference <alias> <target-assembly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="Design\CodeFixes\CA1001CSharpCodeFixProvider.cs" />
<Compile Include="Design\CodeFixes\CA1008CSharpCodeFixProvider.cs" />
<Compile Include="Design\CodeFixes\CA1052CSharpCodeFixProvider.cs" />
<Compile Include="Design\CodeFixes\EnumWithFlagsCSharpCodeFixProvider.cs" />
Expand Down Expand Up @@ -107,4 +106,4 @@
<Import Project="..\..\..\..\build\VSL.Imports.Closed.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
</Project>
Loading