Ada applies ignored ghost regions for ignored pragmas
The Ada front end now marks ignored pragmas as belonging to 'ignored ghost regions,' improving their cleanup.
This commit modifies the Ada front end to formally apply ‘ignored ghost regions’ to pragmas that the compiler chooses to ignore. By explicitly marking these pragmas as part of an ignored region, the compiler can more accurately identify and remove them during its internal processing. This ensures that unused pragma information does not unnecessarily persist through later compilation stages.
In Details
In the GCC Ada front end, the ghost.adb module manages ghost regions, which are sections of the Abstract Syntax Tree (AST) that are not to be emitted as code. This commit extends the Set_Ghost_Mode function to encompass ignored pragmas, assigning them to an 'ignored ghost region.' Concurrently, sem_prag.adb's Analyze_Pragma function is updated to mark these ignored pragmas as such, thereby integrating them into the existing ghost code removal infrastructure.
For Context
Compilers like GCC create an internal, tree-like representation of your code called an Abstract Syntax Tree (AST). Sometimes, parts of your source code are directives to the compiler (like pragmas in Ada) but don't result in executable code. If the compiler decides to ignore such a pragma, it's considered 'ghost code.' This change enhances how the Ada compiler handles these ignored pragmas by formally grouping them into 'ignored ghost regions.' This tells the compiler that everything within these regions should be completely removed from the internal representation, preventing these unused directives from cluttering the AST and potentially slowing down later compilation steps.