As pointed out in the comments, you have to use integration by parts. The first term, $f(x)\delta(x-x')$ has to be evaluated at $-\infty$ and $+\infty$. Those 2 vanish because the Dirac delta is zero everywhere except for $x=x'$. The remaining part is simply
$$ -\int \mathrm{d}x \frac{\mathrm{d}f(x)}{\mathrm{d}x}\delta(x-x') = -\frac{\mathrm{d}f(x)}{\mathrm{d}x}\big|_{x'}$$
You can get an intuitive picture by approximating the Delta function by a nascent version, and thinking about its derivative. It would look like a function with two sharp peaks, the first positive and the second negative, very close to each other. This effectively extracts from the integral the values of $f(x-\Delta x/2)$ and $f(x+\Delta x/2)$, where $\Delta x$ is the width of the nascent delta. It is now clear where the minus derivative of $f$ comes from, except for the missing $1/\Delta x$. This factor actually comes from the fact that the derivative of the nascent delta function is roughly scaled by a factor of $1/\Delta x$ with respect to the nascent delta itself.
In the figure, the orange line represents $dv$, which is the derivative of $v$. As you can see, $v$ is not zero, but instead becomes a delta function in the appropriate limit.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/8hn4r.png)