In Scottish Law, it was the mother's responsibility to declare the child illegitimate. She could not name the father of the baby unless he accompanied her to the Registrar in person and stated that the child was his. If he was not present and no father was listed, the birth record will clearly state "Illegitimate"
Under Scottish Law, unlike English Law, a birth became legitimate if the parents subsequently married one another. In this instance, you should find a Record of Corrected Entry (RCE) for the birth. The exception here is that if the baby was born as a result of an adulterous relationship. The birth would not then be legitimized even if the parents subsequently married.
Up until the late 1800s illegitimacy was often a matter of course. It was not until the late 1800s, early 1900s that illegitimacy was seen as a social stigma.