Paul McCartney has pledged to give up smoking cannabis for the sake of his eight-year-old daughter Beatrice.