private DiagnosticInfo InitializeUseSiteDiagnostic(DiagnosticInfo diagnostic) { Debug.Assert(!CSDiagnosticInfo.IsEmpty(diagnostic)); if (diagnostic != null) { diagnostic = InterlockedOperations.Initialize(ref AccessUncommonFields()._lazyUseSiteDiagnostic, diagnostic, CSDiagnosticInfo.EmptyErrorInfo); } _packedFlags.SetIsUseSiteDiagnosticPopulated(); return(diagnostic); }
internal override DiagnosticInfo GetUseSiteDiagnostic() { if (!_packedFlags.IsUseSiteDiagnosticPopulated) { DiagnosticInfo result = null; CalculateUseSiteDiagnostic(ref result); EnsureTypeParametersAreLoaded(ref result); return(InitializeUseSiteDiagnostic(result)); } var uncommonFields = _uncommonFields; if (uncommonFields == null) { return(null); } else { var result = uncommonFields._lazyUseSiteDiagnostic; return(CSDiagnosticInfo.IsEmpty(result) ? InterlockedOperations.Initialize(ref uncommonFields._lazyUseSiteDiagnostic, null, CSDiagnosticInfo.EmptyErrorInfo) : result); } }