Example #1
0
        internal Value GetValueFor(LLVMValueRef valueRef, Func <LLVMValueRef, Value> constructor)
        {
            if (valueRef.Pointer == IntPtr.Zero)
            {
                throw new ArgumentNullException(nameof(valueRef));
            }

            if (ValueCache.TryGetValue(valueRef.Pointer, out Value retVal))
            {
                return(retVal);
            }

            retVal = constructor(valueRef);
            ValueCache.Add(valueRef.Pointer, retVal);
            return(retVal);
        }