This problem can occur when your environment has multiple units which #include the header which defines the inline functions. In this situation, the instrumented function is compiled (possibly inlined) separately in each unit. The linker may or may not link in all the separate definitions. If it retains the definition in only 1 unit, then only that unit will appear to have the function covered when it is called. If the function is inlined or defined separately in each unit, then the function will only appear to be covered in the units from which it was called.
The VectorCAST philosophy of code coverage is to show the covered source which corresponds to the executed object code. This specification is important in cases where source code from one location in your source tree is compiled into distinct pieces of object code in your executable software.
For example, consider the following C++ source code:
///////// header.h ////////////
inline int freezing_point(void)
If header.h is #included into a file and USE_CELSIUS has been #defined, then the resulting object code will differ from the case where header.h is #included into a file where USE_FAHRENHEIT has been #defined. For this reason, the coverage information which VectorCAST generates is specific to a unit, even for inline functions that may be compiled into multiple units.
Because a C++ compiler might not inline a function even if it is defined with the inline keyword, it is possible for a function in a unit A to call an inline function whose definition comes from another unit. In this case the inline definition in unit A will never show code coverage.Therefore, when testing and generating code coverage results in VectorCAST, you may not be able to achieve full coverage of such inline functions.
To accommodate the need to show such functions as covered, VectorCAST introduced a new option called Show inlines as covered in all units. Enabling this option along with Provide code coverage in header files will allow inline functions to show the same coverage information in each unit in which they appear. To use the option with an existing environment, turn it on and then re-instrument your source files and re-execute your tests.
The option works by replicating the coverage data across units dynamically during the processing of the coverage data. The replication will not be explicitly recorded in coverage scripts, but the option can be utilized when importing results in a different environment as long as the destination environment contains the unit for which the original coverage data was recorded and the units in the destination environment were instrumented with the option enabled.