Ejemplo n.º 1
0
        /// <summary>Adds a global to this module with a specific address space</summary>
        /// <param name="addressSpace">Address space to add the global to</param>
        /// <param name="typeRef">Type of the value</param>
        /// <param name="name">Name of the global</param>
        /// <returns>The new <see cref="GlobalVariable"/></returns>
        /// <openissues>
        /// - What does LLVM do if creating a second Global with the same name (return null, throw, crash??,...)
        /// </openissues>
        public GlobalVariable AddGlobalInAddressSpace(uint addressSpace, ITypeRef typeRef, string name)
        {
            ThrowIfDisposed( );

            var handle = ModuleHandle.AddGlobalInAddressSpace(typeRef.GetTypeRef( ), name, addressSpace);

            return(Value.FromHandle <GlobalVariable>(handle) !);
        }