Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitce87f30

Browse files
committed
Suppress generation of DebuggerBrowsable if not in mscorlib
Mono 2.1 profile does not have DebuggerBrowsable attribute. This meanswwe currently give an invalid FSHarp.Core.dll for Mono 2.1 profile.Suppress the generation of DebuggerBrowsablee if the attribute does notoccur in mscorlib.dll
1 parentf3f52f8 commitce87f30

File tree

6 files changed

+28
-11
lines changed

6 files changed

+28
-11
lines changed

‎src/absil/il.fs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,6 +2425,7 @@ type ILGlobals =
24252425
{ mscorlibScopeRef:ILScopeRef;
24262426
mscorlibAssemblyName:string;
24272427
noDebugData:bool;
2428+
generateDebugBrowsableData:bool;
24282429
tref_Object:ILTypeRef
24292430
; tspec_Object:ILTypeSpec
24302431
; typ_Object:ILType
@@ -2527,7 +2528,7 @@ let tname_CompilerGeneratedAttribute = "System.Runtime.CompilerServices.Compiler
25272528
lettname_DebuggableAttribute="System.Diagnostics.DebuggableAttribute"
25282529

25292530

2530-
letmkILGlobals mscorlibScopeRef mscorlibAssemblyNameOpt noDebugData=
2531+
letmkILGlobals mscorlibScopeRef mscorlibAssemblyNameOpt(noDebugData,generateDebugBrowsableData)=
25312532
letmscorlibAssemblyName=
25322533
match mscorlibAssemblyNameOptwith
25332534
| Some name-> name
@@ -2680,6 +2681,7 @@ let mkILGlobals mscorlibScopeRef mscorlibAssemblyNameOpt noDebugData =
26802681
{ mscorlibScopeRef=mscorlibScopeRef
26812682
; mscorlibAssemblyName=mscorlibAssemblyName
26822683
; noDebugData=noDebugData
2684+
; generateDebugBrowsableData=generateDebugBrowsableData
26832685
; tref_Object=tref_Object
26842686
; tspec_Object=tspec_Object
26852687
; typ_Object=typ_Object
@@ -2760,7 +2762,7 @@ let ecmaPublicKey = PublicKeyToken (Bytes.ofInt32Array [|0xde; 0xad; 0xbe; 0xef;
27602762

27612763
letecmaMscorlibScopeRef= ILScopeRef.Assembly(ILAssemblyRef.Create("mscorlib", None, Some ecmaPublicKey,true, None, None))
27622764

2763-
letecmaILGlobals= mkILGlobals ecmaMscorlibScopeRef Nonefalse
2765+
letecmaILGlobals= mkILGlobals ecmaMscorlibScopeRef None(false,true)
27642766

27652767
letmkInitializeArrayMethSpec ilg=
27662768
mkILNonGenericStaticMethSpecInTy(mkILNonGenericBoxedTy(mkILTyRef(ilg.mscorlibScopeRef,"System.Runtime.CompilerServices.RuntimeHelpers")),"InitializeArray",[ilg.typ_Array;ilg.typ_RuntimeFieldHandle], ILType.Void)
@@ -4392,7 +4394,9 @@ let addMethodGeneratedAttrs ilg (mdef:ILMethodDef) = {mdef with CustomAttrs
43924394
letaddPropertyGeneratedAttrs ilg(pdef:ILPropertyDef)={pdefwith CustomAttrs= addGeneratedAttrs ilg pdef.CustomAttrs}
43934395
letaddFieldGeneratedAttrs ilg(fdef:ILFieldDef)={fdefwith CustomAttrs= addGeneratedAttrs ilg fdef.CustomAttrs}
43944396

4395-
letadd_never_attrs ilg(attrs:ILAttributes)= mkILCustomAttrs(attrs.AsList@[mkDebuggerBrowsableNeverAttribute ilg])
4397+
letadd_never_attrs ilg(attrs:ILAttributes)=
4398+
if ilg.generateDebugBrowsableDatathen mkILCustomAttrs(attrs.AsList@[mkDebuggerBrowsableNeverAttribute ilg])
4399+
else attrs
43964400
letaddPropertyNeverAttrs ilg(pdef:ILPropertyDef)={pdefwith CustomAttrs= add_never_attrs ilg pdef.CustomAttrs}
43974401
letaddFieldNeverAttrs ilg(fdef:ILFieldDef)={fdefwith CustomAttrs= add_never_attrs ilg fdef.CustomAttrs}
43984402

‎src/absil/il.fsi‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,6 +1679,7 @@ type ILGlobals =
16791679
{ mscorlibScopeRef:ILScopeRef
16801680
mscorlibAssemblyName:string
16811681
noDebugData:bool
1682+
generateDebugBrowsableData:bool
16821683
tref_Object:ILTypeRef
16831684
tspec_Object:ILTypeSpec
16841685
typ_Object:ILType
@@ -1753,7 +1754,7 @@ type ILGlobals =
17531754
mutable debuggerTypeProxyAttributeCache:ILAttribute option}
17541755

17551756
/// Build the table of commonly used references given a ILScopeRef for mscorlib.
1756-
valmkILGlobals:ILScopeRef->string option->bool->ILGlobals
1757+
valmkILGlobals:mscorlibScopeRef:ILScopeRef->mscorlibAssemblyNameOpt:string option->noDebugData:bool* generateDebugBrowsableData:bool-> ILGlobals
17571758

17581759

17591760
/// When writing a binary the fake"toplevel" type definition(called<Module>)

‎src/absil/ilwrite.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4612,7 +4612,7 @@ type options =
46124612

46134613

46144614
letWriteILBinary outfile(args:options)modul noDebugData=
4615-
ignore(writeBinaryAndReportMappings(outfile, args.mscorlib, args.pdbfile, args.signer, args.fixupOverlappingSequencePoints, args.emitTailcalls, args.showTimes, args.dumpDebugInfo) modul noDebugData)
4615+
ignore(writeBinaryAndReportMappings(outfile, args.mscorlib, args.pdbfile, args.signer, args.fixupOverlappingSequencePoints, args.emitTailcalls, args.showTimes, args.dumpDebugInfo) modul(noDebugData,true))
46164616

46174617

46184618

‎src/fsharp/build.fs‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,7 +2100,7 @@ type TcConfigBuilder =
21002100
letOpenILBinary(filename,optimizeForMemory,openBinariesInMemory,ilGlobalsOpt,pdbPathOption,mscorlibAssemblyName,noDebugData)=
21012101
letilGlobals=
21022102
match ilGlobalsOptwith
2103-
| None-> mkILGlobals ILScopeRef.Local(Some mscorlibAssemblyName) noDebugData
2103+
| None-> mkILGlobals ILScopeRef.Local(Some mscorlibAssemblyName)(noDebugData,true)
21042104
| Some ilGlobals-> ilGlobals
21052105
letopts={ ILBinaryReader.defaultswith
21062106
ILBinaryReader.ilGlobals=ilGlobals;
@@ -4128,7 +4128,12 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
41284128
match frameworkTcImports.RegisterAndImportReferencedAssemblies(None,[mscorlibResolution])with
41294129
|(_,[ResolvedImportedAssembly(sysCcu)])-> sysCcu
41304130
|_-> error(InternalError("BuildFoundationalTcImports: no sysCcu for"+mscorlibReference.Text,rangeStartup))
4131-
letilGlobals= mkILGlobals sysCcu.FSharpViewOfMetadata.ILScopeRef(Some tcConfig.mscorlibAssemblyName) tcConfig.noDebugData
4131+
4132+
letgenerateDebugBrowsableData=
4133+
ccuHasType sysCcu.FSharpViewOfMetadata["System";"Diagnostics"]"DebuggerBrowsableAttribute"&&
4134+
ccuHasType sysCcu.FSharpViewOfMetadata["System";"Diagnostics"]"DebuggerBrowsableState"
4135+
4136+
letilGlobals= mkILGlobals sysCcu.FSharpViewOfMetadata.ILScopeRef(Some tcConfig.mscorlibAssemblyName)(tcConfig.noDebugData,not generateDebugBrowsableData)
41324137
frameworkTcImports.SetILGlobals ilGlobals
41334138

41344139
// Load the rest of the framework DLLs all at once (they may be mutually recursive)

‎src/fsharp/fsc.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ module StaticLinker =
12841284

12851285
letilBinaryReader=
12861286
letopts={ ILBinaryReader.defaultswith
1287-
ilGlobals=mkILGlobals ILScopeRef.Local(Some tcConfig.mscorlibAssemblyName) tcConfig.noDebugData;
1287+
ilGlobals=mkILGlobals ILScopeRef.Local(Some tcConfig.mscorlibAssemblyName)(tcConfig.noDebugData,false);
12881288
optimizeForMemory=tcConfig.optimizeForMemory;
12891289
pdbPath= None;}
12901290
ILBinaryReader.OpenILModuleReader mscorlib40 opts

‎src/fsharp/ilxgen.fs‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,9 @@ let GenConstArray cenv (cgbuf:CodeGenBuffer) eenv ilElementType (data:'a[]) (wri
15041504
letilFieldName= CompilerGeneratedName("field"+ string(newUnique()))
15051505
letfty= ILType.Value vtspec
15061506
letilFieldDef= mkILStaticField(ilFieldName,fty, None, Some bytes, ILMemberAccess.Assembly)
1507-
letilFieldDef={ ilFieldDefwith CustomAttrs= mkILCustomAttrs[ mkDebuggerBrowsableNeverAttribute cenv.g.ilg]}
1507+
letilFieldDef={ ilFieldDefwith CustomAttrs=
1508+
if cenv.g.ilg.generateDebugBrowsableDatathen mkILCustomAttrs[ mkDebuggerBrowsableNeverAttribute cenv.g.ilg]
1509+
else emptyILCustomAttrs}
15081510
letfspec= mkILFieldSpecInTy(mkILTyForCompLoc eenv.cloc,ilFieldName, fty)
15091511
CountStaticFieldDef();
15101512
cgbuf.mgbuf.AddFieldDef(fspec.EnclosingTypeRef,ilFieldDef);
@@ -4804,7 +4806,11 @@ and GenBindAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) =
48044806

48054807
letilFieldDef=
48064808
{ ilFieldDefwith
4807-
CustomAttrs= mkILCustomAttrs(ilAttribs@[ mkDebuggerBrowsableNeverAttribute cenv.g.ilg])}
4809+
CustomAttrs=
4810+
if cenv.g.ilg.generateDebugBrowsableDatathen
4811+
mkILCustomAttrs(ilAttribs@[ mkDebuggerBrowsableNeverAttribute cenv.g.ilg])
4812+
else
4813+
mkILCustomAttrs ilAttribs}
48084814
[(fspec.EnclosingTypeRef, ilFieldDef)]
48094815

48104816

@@ -6353,7 +6359,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon:Tycon) =
63536359

63546360
letextraAttribs=
63556361
match tyconReprwith
6356-
| TRecdRepr_whennot useGenuineField->[ mkDebuggerBrowsableNeverAttribute cenv.g.ilg]// hide fields in records in debug display
6362+
| TRecdRepr_whennot useGenuineField&& cenv.g.ilg.generateDebugBrowsableData->
6363+
[ mkDebuggerBrowsableNeverAttribute cenv.g.ilg]// hide fields in records in debug display
63576364
|_->[]// don't hide fields in classes in debug display
63586365

63596366
yield

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp