It would stand to reason that WD-40, which is largely a solvent, would be excellent for cleaning weapons. However, it is NOT suggested to use WD40 to clean your firearms. Solvents like WD40 don't get rid of any grime or muck. Gunk is dissolved by solvents, which then transport the dissolved goo to a hidden section of your gun.
WD-40 is NOT a gun lubricant; it is a solvent. Because it evaporates so quickly, WD-40 is not a good lubricant for firearms. It would almost probably evaporate by the time you loaded your rounds and began firing, leaving your pistol completely dry between the time you sprayed it on the chamber or slide and that point.