diagnostics: Fix macro tracking for ad-hoc locations

The result of linemap_resolve_location() can be an ad-hoc location, if that is
what was stored in a relevant macro map.  maybe_unwind_expanded_macro_loc()
did not previously handle this case, causing it to print the wrong tracking
information for an example such as the new testcase macro-trace-1.c.  Fix that
by checking for ad-hoc locations where needed.

gcc/ChangeLog:

	* tree-diagnostic.cc (maybe_unwind_expanded_macro_loc): Handle ad-hoc
	location in return value of linemap_resolve_location().

gcc/testsuite/ChangeLog:

	* c-c++-common/cpp/macro-trace-1.c: New test.
2 files changed