当前位置: 首页>>代码示例>>C#>>正文


C# TraitCollector.CollectProgramTraits方法代码示例

本文整理汇总了C#中TraitCollector.CollectProgramTraits方法的典型用法代码示例。如果您正苦于以下问题:C# TraitCollector.CollectProgramTraits方法的具体用法?C# TraitCollector.CollectProgramTraits怎么用?C# TraitCollector.CollectProgramTraits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TraitCollector的用法示例。


在下文中一共展示了TraitCollector.CollectProgramTraits方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunTest

        protected override void RunTest(Program program, string outputFileName)
        {
            ExpressionNormalizer aen = new ExpressionNormalizer(program.Architecture.PointerType);
            aen.Transform(program);
            EquivalenceClassBuilder eq = new EquivalenceClassBuilder(factory, store);
            eq.Build(program);
#if OLD
            			DataTypeBuilder dtb = new DataTypeBuilder(factory, store, program.Architecture);
			TraitCollector coll = new TraitCollector(factory, store, dtb, program);
			coll.CollectProgramTraits(program);
			dtb.BuildEquivalenceClassDataTypes();
#else
            TypeCollector coll = new TypeCollector(factory, store, program);
            coll.CollectTypes();
            store.BuildEquivalenceClassDataTypes(factory);
#endif

            TypeVariableReplacer tvr = new TypeVariableReplacer(store);
            tvr.ReplaceTypeVariables();

            TypeTransformer trans = new TypeTransformer(factory, store, program);
            trans.Transform();
            using (FileUnitTester fut = new FileUnitTester(outputFileName))
            {
                foreach (Procedure proc in program.Procedures.Values)
                {
                    proc.Write(false, fut.TextWriter);
                    fut.TextWriter.WriteLine();
                }
                store.Write(fut.TextWriter);
                fut.AssertFilesEqual();
            }
        }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:33,代码来源:TypeTransformTests.cs

示例2: RunTest

		protected override void RunTest(Program prog, string outputFilename)
		{
			eqb.Build(prog);
			trco = new TraitCollector(factory, store, dtb, prog);
			trco.CollectProgramTraits(prog);
			dtb.BuildEquivalenceClassDataTypes();

			store.CopyClassDataTypesToTypeVariables();
			TypeVariableReplacer tvr = new TypeVariableReplacer(store);
			tvr.ReplaceTypeVariables();

			Verify(outputFilename);
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:13,代码来源:TypeVarReplacerTests.cs

示例3: RunTest

        protected override void RunTest(Program program, string outputFileName)
        {
            ExpressionNormalizer aen = new ExpressionNormalizer(program.Architecture.PointerType);
            aen.Transform(program);
            EquivalenceClassBuilder eq = new EquivalenceClassBuilder(factory, store);
            eq.Build(program);
#if OLD
			DataTypeBuilder dtb = new DataTypeBuilder(factory, store, program.Architecture);
			TraitCollector coll = new TraitCollector(factory, store, dtb, program);
			coll.CollectProgramTraits(program);
			sktore.BuildEquivalenceClassDataTypes(factory);
#else
            TypeCollector coll = new TypeCollector(factory, store, program, new FakeDecompilerEventListener());
            coll.CollectTypes();

            store.BuildEquivalenceClassDataTypes(factory);
#endif

            TypeVariableReplacer tvr = new TypeVariableReplacer(store);
            tvr.ReplaceTypeVariables();

            Exception theEx = null;
            try
            {
                TypeTransformer trans = new TypeTransformer(factory, store, program);
                trans.Transform();
            } catch (Exception ex)
            {
                theEx = ex;
            }
            using (FileUnitTester fut = new FileUnitTester(outputFileName))
            {
                if (theEx != null)
                {
                    fut.TextWriter.WriteLine(theEx.Message);
                    fut.TextWriter.WriteLine(theEx.StackTrace);
                }
                foreach (Procedure proc in program.Procedures.Values)
                {
                    proc.Write(false, fut.TextWriter);
                    fut.TextWriter.WriteLine();
                }
                store.Write(fut.TextWriter);
                fut.AssertFilesEqual();
            }
        }
开发者ID:relaxar,项目名称:reko,代码行数:46,代码来源:TypeTransformTests.cs

示例4: RunTest

        private void RunTest(Program program, string outputFile)
        {
            EquivalenceClassBuilder eqb = new EquivalenceClassBuilder(factory, store);
            DataTypeBuilder dtb = new DataTypeBuilder(factory, store, program.Platform);
            eqb.Build(program);
            TraitCollector trco = new TraitCollector(factory, store, dtb, program);
            trco.CollectProgramTraits(program);
            dtb.BuildEquivalenceClassDataTypes();
            var tv = new TypeVariableReplacer(store);
            tv.ReplaceTypeVariables();
            store.CopyClassDataTypesToTypeVariables();
            var ppr = new PtrPrimitiveReplacer(factory, store, program);
            ppr.ReplaceAll(new FakeDecompilerEventListener());

            var cpa = new ConstantPointerAnalysis(factory, store, program);
            cpa.FollowConstantPointers();

            Verify(null, outputFile);
        }
开发者ID:relaxar,项目名称:reko,代码行数:19,代码来源:ConstantPointerAnalysisTests.cs

示例5: RunTest

        protected override void RunTest(Program prog, string outputFilename)
		{
			TypeFactory factory = new TypeFactory();
			store = new TypeStore();
			EquivalenceClassBuilder eqb = new EquivalenceClassBuilder(factory, store);
			eqb.Build(prog);
			DataTypeBuilder dtb = new DataTypeBuilder(factory, store, prog.Platform);
			TraitCollector trco = new TraitCollector(factory, store, dtb, prog);
			trco.CollectProgramTraits(prog);
			dtb.BuildEquivalenceClassDataTypes();

			store.CopyClassDataTypesToTypeVariables();
			TypeVariableReplacer tvr = new TypeVariableReplacer(store);
			tvr.ReplaceTypeVariables();

			PtrPrimitiveReplacer ppr = new PtrPrimitiveReplacer(factory, store, prog);
			ppr.ReplaceAll(new FakeDecompilerEventListener());

			Verify(prog, outputFilename);
		}
开发者ID:relaxar,项目名称:reko,代码行数:20,代码来源:PtrPrimitiveReplacerTests.cs

示例6: RunTest

        protected override void RunTest(Program program, string outputFile)
        {
            using (FileUnitTester fut = new FileUnitTester(outputFile))
            {
                fut.TextWriter.WriteLine("// Before ///////");
                DumpProgram(program, fut);

                SetupPreStages(program);
                aen.Transform(program);
                eqb.Build(program);
#if OLD
                coll = new TraitCollector(factory, store, dtb, program);
                coll.CollectProgramTraits(program);
#else
                var coll = new TypeCollector(program.TypeFactory, program.TypeStore, program);
                coll.CollectTypes();
#endif
                program.TypeStore.BuildEquivalenceClassDataTypes(program.TypeFactory);
                program.TypeStore.Dump();
                tvr.ReplaceTypeVariables();
                trans.Transform();
                ctn.RenameAllTypes(program.TypeStore);

                ter = new TypedExpressionRewriter(program);
                try
                {
                    ter.RewriteProgram(program);
                }
                catch (Exception ex)
                {
                    fut.TextWriter.WriteLine("** Exception **");
                    fut.TextWriter.WriteLine(ex);
                }
                finally
                {
                    fut.TextWriter.WriteLine("// After ///////");
                    DumpProgAndStore(program, fut);
                }
            }
        }
开发者ID:killbug2004,项目名称:reko,代码行数:40,代码来源:TypedExpressionRewriterTests.cs

示例7: RewriteProgram

        /// <summary>
        /// Performs type analysis and rewrites program based on the inferred information.
        /// </summary>
        /// <remarks>
        /// For instance, all MemoryAccesses will be converted to structure field
        /// accesses or array accesses as appropriate.
        /// </remarks>
        /// <param name="program"></param>
        public void RewriteProgram(Program program)
        {
            factory = program.TypeFactory;
            store = program.TypeStore;

            aen = new ExpressionNormalizer(program.Platform.PointerType);
            eqb = new EquivalenceClassBuilder(factory, store);
            dtb = new DataTypeBuilder(factory, store, program.Platform);
            trco = new TraitCollector(factory, store, dtb, program);
            //dpa = new DerivedPointerAnalysis(factory, store, program.Architecture);
            tvr = new TypeVariableReplacer(store);
            trans = new TypeTransformer(factory, store,program, eventListener);
            ctn = new ComplexTypeNamer();
            ter = new TypedExpressionRewriter(program);

            // RestrictProcedures(program, 0, 1, true); // Re-enable this for debugging
            eventListener.ShowStatus("Gathering primitive datatypes from instructions.");
            aen.Transform(program);
            eqb.Build(program);
            eventListener.ShowStatus("Collecting datatype usage traits.");
            trco.CollectProgramTraits(program);
            eventListener.ShowStatus("Building equivalence classes.");
            dtb.BuildEquivalenceClassDataTypes();
            //dpa.FollowConstantPointers(prog);
            tvr.ReplaceTypeVariables();

            eventListener.ShowStatus("Transforming datatypes.");
            var ppr = new PtrPrimitiveReplacer(factory, store, program);
            ppr.ReplaceAll();

            trans.Transform();
            ctn.RenameAllTypes(store);
            store.Dump();
            eventListener.ShowStatus("Rewriting expressions.");
            ter.RewriteProgram(program);
        }
开发者ID:nemerle,项目名称:reko,代码行数:44,代码来源:TypeAnalyzer.cs

示例8: RunStringTest

        protected void RunStringTest(Program program, string expectedOutput)
        {
            var sw = new StringWriter();
            sw.WriteLine("// Before ///////");
            DumpProgram(program, sw);

            var eventListener = new FakeDecompilerEventListener();
            SetupPreStages(program);
            aen.Transform(program);
            eqb.Build(program);
#if OLD
            coll = new TraitCollector(program.TypeFactory, program.TypeStore, dtb, program);
            coll.CollectProgramTraits(program);
#else
            var coll = new TypeCollector(program.TypeFactory, program.TypeStore, program, eventListener);
            coll.CollectTypes();
#endif
            program.TypeStore.BuildEquivalenceClassDataTypes(program.TypeFactory);
            tvr.ReplaceTypeVariables();
            trans.Transform();
            ctn.RenameAllTypes(program.TypeStore);

            var ter = new TypedExpressionRewriter(program, eventListener);
            try
            {
                ter.RewriteProgram(program);
            }
            catch (Exception ex)
            {
                sw.WriteLine("** Exception **");
                sw.WriteLine(ex);
                throw;
            }
            finally
            {
                sw.WriteLine("// After ///////");
                DumpProgram(program, sw);
            }
            var sActual = sw.ToString();
            if (expectedOutput != sActual)
            {
                Debug.Print(sActual);
                Assert.AreEqual(expectedOutput, sActual);
            }
        }
开发者ID:relaxar,项目名称:reko,代码行数:45,代码来源:TypedExpressionRewriterTests.cs

示例9: RunTest

        protected override void RunTest(Program prog, string outFile)
		{
            coll = CreateCollector(prog);
            en.Transform(prog);
            eqb.Build(prog);
			coll.CollectProgramTraits(prog);

			using (FileUnitTester fut = new FileUnitTester(outFile))
			{
				foreach (Procedure proc in prog.Procedures.Values)
				{
					proc.Write(false, fut.TextWriter);
					fut.TextWriter.WriteLine();
				}
				handler.Traits.Write(fut.TextWriter);
				fut.AssertFilesEqual();
			}
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:18,代码来源:TraitCollectorTests.cs

示例10: TrcoStaggeredArraysMock

		public void TrcoStaggeredArraysMock()
		{
			ProgramBuilder mock = new ProgramBuilder();
			mock.Add(new StaggeredArraysFragment());
			Program prog = mock.BuildProgram();
            coll = CreateCollector(prog);

			en.Transform(prog);
			eqb.Build(prog);
			coll.CollectProgramTraits(prog);

			Verify(prog, "Typing/TrcoStaggeredArraysMock.txt");
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:13,代码来源:TraitCollectorTests.cs

示例11: TrcoCmpMock

		public void TrcoCmpMock()
		{
			ProgramBuilder mock = new ProgramBuilder();
			mock.Add(new CmpMock());
			Program prog = mock.BuildProgram();
            coll = CreateCollector(prog);
            eqb.Build(prog);
			coll.CollectProgramTraits(prog);

			Verify(prog, "Typing/TrcoCmpMock.txt");
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:11,代码来源:TraitCollectorTests.cs


注:本文中的TraitCollector.CollectProgramTraits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。