4.3.6.2 How Do I Add a Trap Interrupt Vector to a Project?

The compiler treats hard traps the same as normal interrupt vectors, as they have names just like the handlers for peripherals. A useful place to find all the interrupt functions supported by a particular device is in the docs folder of your install: 
vector_index.html.

The general format is:

void __attribute__((interrupt)) ISR_fn_name(void) {

}