官术网_书友最值得收藏!

Creating a compilation analyzer to analyze whole compilation and report issues

A stateful compilation analyzer registers action callbacks that require compilation-wide analysis of symbols and/or syntax to report issues about declarations or executable code in the compilation. These analyzers generally need to initialize some mutable state at the start of the analysis, which is updated while analyzing the compilation, and the final state is used to report diagnostics.

In this section, we will create an analyzer that performs compilation-wide analysis and reports. Diagnostic secure types must not implement interfaces with insecure methods for the following scenarios:

  • Assume we have an interface, say MyNamespace.ISecureType, which is a well-known secure interface, i.e. it is a marker for all secure types in an assembly.
  • Assume we have a method attribute, say MyNamespace.InsecureMethodAttribute, which marks the method on which the attribute is applied as insecure. An interface which has any member with such an attribute, must be considered insecure.
  • We want to report diagnostics for types implementing the well-known secure interface that also implements any insecure interfaces.

Analyzer performs compilation-wide analysis to detect such violating types and reports diagnostics for them in the compilation end action.

主站蜘蛛池模板: 岫岩| 昌邑市| 策勒县| 三门峡市| 秦安县| 泽普县| 汉阴县| 芦溪县| 巴彦县| 江源县| 长兴县| 怀远县| 宁波市| 桦甸市| 永昌县| 光泽县| 河津市| 乐都县| 自贡市| 林口县| 文水县| 墨江| 汶上县| 巴里| 突泉县| 青铜峡市| 邹平县| 赫章县| 龙海市| 南岸区| 酒泉市| 鄂托克前旗| 锡林浩特市| 新源县| 沁源县| 长乐市| 韶关市| 临漳县| 内丘县| 体育| 资源县|