private void DisposeDiagnosticSet() { if (_diagSet != null) { _diagSet.Dispose(); _diagSet = null; } }
/// <summary> /// The HandleDiagnostic /// </summary> /// <param name="client_data">The client_data<see cref="IntPtr"/></param> /// <param name="diagnosticSet">The set<see cref="IntPtr"/></param> /// <param name="reserved">The reserved<see cref="IntPtr"/></param> private void HandleDiagnostic(IntPtr client_data, IntPtr diagnosticSet, IntPtr reserved) { GCHandle paramGCHandle = GCHandle.FromIntPtr(client_data); object param = paramGCHandle.Target; DiagnosticSet diagnostics = new DiagnosticSet(diagnosticSet); this._indexActionEventHandler?.OnDiagnostic(diagnostics, param); }
/// <summary> /// The TryLoadDiagnostics /// </summary> /// <param name="fileName">The fileName<see cref="string"/></param> /// <param name="diagnosticSet">The diagnosticSet<see cref="DiagnosticSet"/></param> /// <param name="error">The error<see cref="CXLoadDiag_Error"/></param> /// <returns>The <see cref="bool"/></returns> public static bool TryLoadDiagnostics(string fileName, out DiagnosticSet diagnosticSet, out CXLoadDiag_Error error) { error = CXLoadDiag_Error.CXLoadDiag_None; CXString cXString; diagnosticSet = null; IntPtr diagnostic = clang.clang_loadDiagnostics(fileName, out error, out cXString); if (diagnostic == IntPtr.Zero) { return(false); } diagnosticSet = new DiagnosticSet(diagnostic); return(true); }