Use a backtracing alogirthm to match all possible source locations to match the FileID of the Caret location.
This can map the ranges back as much as possible.
You can see some new ranges underlined in the diagnostic information In the test cases modified. This can prove that the new method is effective.
(Solved https://llvm.org/bugs/show_bug.cgi?id=24592)
Also change the standard to judge if the macro backtraces should be reduced.
Using raw encodings to specify if the ranges are all in one argument of the macro invocations.
But this part is still questionable due to some bugs inside the preprocessor system. (See: https://llvm.org/bugs/show_bug.cgi?id=24788)
In the other function, there is "End = SM->getImmediateExpansionRange(Backup).second;" Why is there not a "Begin = SM->getImmediateExpansionRange(Backup).first;" here?