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

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.

主站蜘蛛池模板: 永川市| 怀柔区| 育儿| 大竹县| 绵阳市| 江达县| 乡城县| 云南省| 平江县| 长寿区| 阜平县| 两当县| 英德市| 三门峡市| 夏津县| 寿阳县| 册亨县| 潞城市| 龙山县| 门头沟区| 江西省| 嵩明县| 吉木萨尔县| 西林县| 汾西县| 水城县| 互助| 高淳县| 金溪县| 凯里市| 旬邑县| 江城| 抚顺县| 土默特右旗| 钦州市| 遵义市| 讷河市| 牟定县| 常山县| 临朐县| 高阳县|