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

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.

主站蜘蛛池模板: 漯河市| 威信县| 庆元县| 定边县| 金华市| 桂阳县| 庆城县| 翼城县| 泉州市| 乐平市| 普宁市| 嘉黎县| 河津市| 抚宁县| 精河县| 怀柔区| 浑源县| 朝阳区| 兴山县| 万年县| 同江市| 耿马| 白玉县| 利津县| 望都县| 锦屏县| 罗甸县| 岢岚县| 黄冈市| 葫芦岛市| 乌鲁木齐市| 志丹县| 泾阳县| 高台县| 南阳市| 乳源| 宜春市| 潮州市| 临沧市| 富蕴县| 马公市|