Using the singularity theory of scalar functions, we derive a classification of sliding bifurcations in piecewise-smooth flows. These are global bifurcations which occur when distinguished orbits become tangent to surfaces of discontinuity, called switching manifolds. The key idea of the paper is to attribute sliding bifurcations to singularities in the manifold's projection along the flow, namely to points where the projection contains folds, cusps, and two-folds (saddles and bowls). From the possible local configurations of orbits we obtain sliding bifurcations. In this way we derive a complete classification of generic one-parameter sliding bifurcations at a smooth codimension one switching manifold in two or more dimensions. We uncover previously unknown sliding bifurcations, all of which are catastrophic in nature. We also describe how the method can be extended to sliding bifurcations of codimension two or higher.