Main Content

Analyze class contents only (-class-only)

Do not analyze code other than class methods

Description

This option affects a Code Prover analysis only.

This option is not available for code generated from MATLAB® code or Simulink® models.

Specify that Polyspace® must verify only methods of classes that you specify using the option Class (-class-analyzer).

Set Option

User interface (desktop products only): In your project configuration, the option is on the Code Prover Verification node. See Dependencies for other options that you must also enable.

User interface (Polyspace Platform, desktop products only): In your project configuration, the option is on the Static Analysis tab on the Run Time Errors node. See Dependencies for other options that you must also enable.

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

Why Use This Option

Use this option to restrict the analysis to certain class methods only.

You specify these methods through the options:

When you analyze a module or library, Code Prover generates a main function if one does not exist. The main function calls class methods using these two options and functions that are not class methods using other options. Code Prover analyzes these methods and functions for robustness to all inputs. If you use this option, Code Prover analyzes the methods only.

Settings

On

Polyspace verifies the class methods only. It stubs functions out of class scope even if the functions are defined in your code.

Off (default)

Polyspace verifies functions out of class scope in addition to class methods.

Dependencies

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

If you select this option, you must specify the classes using the Class (-class-analyzer) option.

Tips

Use this option:

  • For robustness verification of class methods. Unless you use this option, Polyspace verifies methods that you call in your code only for your input combinations.

  • In case of scaling.

Command-Line Information

Parameter: -class-only
Default: Off
Example (Code Prover): polyspace-code-prover -sources file_name -main-generator -class-analyzer custom=myClass1,myClass2 -class-analyzer-calls unused-public -class-only
Example (Code Prover Server): polyspace-code-prover-server -sources file_name -main-generator -class-analyzer custom=myClass1,myClass2 -class-analyzer-calls unused-public -class-only