In theory, WMT and MCD get as much boost in a recession from people switching from higher cost competitors, as they lose from their regular customers having less to spend.
In any given recession, the market may or may not choose to buy that theory. Also, a recession gives all companies (even those not really losing profits) an excuse to undo past bookkeeping distortions (write off the results of previously fake profits).
Anyway, if I were seriously worried about an upcoming recession, but not certain enough to switch to cash or to short positions, WMT and MCD would top my list of safer investments.
If the next economic problem is inflation rather than recession, cash or short positions would be disasters, while WMT and MCD would be better than average choices for that case as well.