Patent ID: 8769512

Claim:
A method for adding instrumentation to a body of code to enable generation of code coverage data for said body of code, said method comprising the steps of: identifying one or more code sections in a body of code for adding instrumentation so as to determine whether or not said code sections are covered during subsequent processing of said body of code; associating a data structure with said body of code, said data structure comprising one or more data elements, each said data element corresponding exclusively to one of said code sections and each said data element being settable between a first state indicating that said corresponding code section has not been processed and a second state indicating that said corresponding code section has been processed; associating a unique code element with each said code section, said code element being arranged when processed to set said data element corresponding exclusively to said code section into said second state so as to indicate that said code section has been processed, said unique code element being further arranged, having set said exclusively corresponding data element to said second state, for removal during subsequent optimization of said body of code; automatically inserting one or more of said unique code elements in said body of code; and associating a further code element with said body of code, said further code element being arranged to prevent removal of said data structure during subsequent optimization of said body of code when all of said data elements are set to said second state.