Hello, and I hope I can help you today. 
It is safe to use any over-the-counter cough syrup that is sold without a doctor's prescription while you are pregnant. Ingredients like 
Dextromethorphan and Guaifenacin are the typical ingredients. As long as there is no alcohol in the formula, it should work to quiet a cough. Cough drops and lose he's also are safe to use. 
However, If you want to protect your baby against 
whooping cough, the best thing to do is to get the vaccine. 
Pertussis vaccination during 
pregnancy is recommended in the US in the third trimester of pregnancy both by the American Board of 
OBGYN and the Academy of Pediatrics. It is important to get the vaccine before the baby is born so the 
antibodies you body produces from the vaccine (the immune proteins in your blood) cross the placenta to passively immunize the baby. Children cannot get the vaccine until age two, so getting the vaccine before the baby is born helps to protect the child until age two. 
You can read about this on the CDC website- www.cdc.gov
I hope I was able to answer your question and that this information was helpful. Best wishes for the rest of your pregnancy and delivery, Dr. Brown