private bool AddComdat(LLVMComdatRef comdatRef) { var comdat = new Comdat(Module, comdatRef); InternalComdatMap.Add(comdat.Name, comdat); return(true); }
private bool AddComdat(LLVMComdatRef comdatRef) { comdatRef.ValidateNotDefault(nameof(comdatRef)); var comdat = new Comdat(Module, comdatRef); InternalComdatMap.Add(comdat.Name, comdat); return(true); }
/// <summary>Removes all the <see cref="Comdat"/> entries from the module</summary> public void Clear( ) { foreach (var obj in GetModuleGlobalObjects( )) { obj.Comdat = null; } InternalComdatMap.Clear( ); LibLLVMModuleComdatClear(Module.ModuleHandle); }
public Comdat Add(string key, ComdatKind kind) { LLVMComdatRef comdatRef = NativeMethods.ModuleInsertOrUpdateComdat(Module.ModuleHandle, key, ( LLVMComdatSelectionKind )kind); if (!InternalComdatMap.TryGetValue(key, out Comdat retVal)) { retVal = new Comdat(Module, comdatRef); InternalComdatMap.Add(retVal.Name, retVal); } return(retVal); }
/// <summary>Inserts or updates a <see cref="Comdat"/> entry</summary> /// <param name="key">Name of the <see cref="Comdat"/></param> /// <param name="kind"><see cref="ComdatKind"/> for the entry</param> /// <returns>New or updated <see cref="Comdat"/></returns> public Comdat InsertOrUpdate(string key, ComdatKind kind) { key.ValidateNotNullOrWhiteSpace(nameof(key)); kind.ValidateDefined(nameof(kind)); LLVMComdatRef comdatRef = LibLLVMModuleInsertOrUpdateComdat(Module.ModuleHandle, key, ( LLVMComdatSelectionKind )kind); if (!InternalComdatMap.TryGetValue(key, out Comdat retVal)) { retVal = new Comdat(Module, comdatRef); InternalComdatMap.Add(retVal.Name, retVal); } return(retVal); }
public bool Remove(string key) { if (!InternalComdatMap.TryGetValue(key, out Comdat value)) { return(false); } bool retVal = InternalComdatMap.Remove(key); if (retVal) { ClearComdatFromGlobals(key); NativeMethods.ModuleComdatRemove(Module.ModuleHandle, value.ComdatHandle); } return(retVal); }
/// <summary>Removes a <see cref="Comdat"/> entry from the module</summary> /// <param name="key">Name of the <see cref="Comdat"/></param> /// <returns> /// <see langword="true"/> if the value was in the list or /// <see langword="false"/> otherwise /// </returns> public bool Remove(string key) { key.ValidateNotNullOrWhiteSpace(nameof(key)); if (!InternalComdatMap.TryGetValue(key, out Comdat value)) { return(false); } bool retVal = InternalComdatMap.Remove(key); if (retVal) { ClearComdatFromGlobals(key); LibLLVMModuleComdatRemove(Module.ModuleHandle, value.ComdatHandle); } return(retVal); }
/// <summary>Gets a value that indicates if a <see cref="Comdat"/> with a given name exists in the collection</summary> /// <param name="key">Name of the <see cref="Comdat"/> to test for</param> /// <returns><see langword="true"/> if the entry is present and <see langword="false"/> if not</returns> public bool Contains(string key) => InternalComdatMap.ContainsKey(key);
/// <summary>Gets a value form the collection if it exists</summary> /// <param name="key">Name of the item to retrieve</param> /// <param name="value">Value of the item if found or <see langword="null"/> if not found</param> /// <returns> /// <see langword="true"/> if the value was found /// the list or <see langword="false"/> otherwise. /// </returns> public bool TryGetValue(string key, out Comdat value) { key.ValidateNotNullOrWhiteSpace(nameof(key)); return(InternalComdatMap.TryGetValue(key, out value)); }
public bool TryGetValue(string key, out Comdat value) => InternalComdatMap.TryGetValue(key, out value);