Main Content

Class (-class-analyzer)

Specify classes that you want to verify

Description

This option affects a Code Prover analysis only.

Specify classes that Polyspace® uses to generate a main.

Set Option

Set the option using one of these methods:

  • Polyspace user interface (desktop products only): In your project configuration, select the Code Prover Verification node and then select this option.

  • Polyspace Platform user interface (desktop products only): In your project configuration, on the Static Analysis tab, select the Run Time Errors node and then select this option. See Dependencies for other options that you must enable first.

  • Command line and options file: Use the option -class-analyzer. See Command-Line Information.

Why Use This Option

If you are verifying a module or library, Code Prover generates a main function if one does not exist. If a main exists, the analysis uses the existing main.

Use this option and the option Functions to call within the specified classes (-class-analyzer-calls) to specify the class methods that the generated main must call. Unless a class method is called directly or indirectly from main, the software does not analyze the method.

Settings

Default: all

all

To generate a main function, Polyspace uses all classes that have at least one method defined outside a header file. The generated main calls methods that you specify using the option Functions to call within the specified classes (-class-analyzer-calls).

none

The generated main cannot call any class method.

custom

To generate a main function, Polyspace uses classes that you specify. The generated main calls methods from classes that you specify using the option Functions to call within the specified classes (-class-analyzer-calls).

Dependencies

You can use this option only if all of the following are true:

If your code contains a main function, this option is ignored.

Tips

  • If you select none for this option, Polyspace will not verify class methods that you do not call explicitly in your code.

  • Polyspace does not verify templates that are not instantiated. To verify a class template, explicitly instantiate a class using the template. See Template Classes.

Command-Line Information

Parameter: -class-analyzer
Value: all | none | custom=class1[,class2,...]
Default: all
Example (Code Prover): polyspace-code-prover -sources file_name -main-generator -class-analyzer custom=myClass1,myClass2
Example (Code Prover Server): polyspace-code-prover-server -sources file_name -main-generator -class-analyzer custom=myClass1,myClass2