Ejemplo n.º 1
0
        /// <summary>Adds a global to this module</summary>
        /// <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 AddGlobal(ITypeRef typeRef, string name)
        {
            ThrowIfDisposed( );

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

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