Ada: Calculate the sloc adjustment for inlined static functions
The Ada compiler now correctly calculates source location when inlining static functions, improving error message accuracy.
This commit enhances the Ada compiler’s inlining of static functions by accurately calculating source location adjustments. This ensures that error messages point to the correct location in the source code, even after inlining, improving the debugging experience. It achieves this by adding a Source File Index entry for the inlined call and applying necessary source location adjustments.
In Details
This commit modifies inline.adb to correctly calculate the source location adjustment when inlining static functions. Previously, the first node calculation could be inaccurate, particularly when inlining functions from the specification. The fix involves adding a Source File Index entry for the call and applying the necessary SLOC adjustment values for all of the inlined nodes. This ensures accurate error reporting in the presence of inlining.
For Context
This commit improves the accuracy of error messages in the Ada compiler when dealing with inlined functions. Function inlining is an optimization technique where the compiler replaces a function call with the function's actual code. This change ensures that if an error occurs within an inlined function, the compiler will correctly pinpoint the source code location of the error, rather than pointing to an incorrect location due to the inlining process. This makes debugging easier and more efficient.