Update diagnostic.cpp

Add comments to the code