Verifying $S(t)=S(0)e^{rt} + \sigma e^{rt} \int_0^t e^{-rs} dW(s) $ satisfies $dS(t) = rS(t)dt + \sigma dW(t)$ Consider the SDE
$$
dS(t) = rS(t)dt + \sigma dW(t).
$$
To solve this, I let $f(t,x) = xe^{-rt}$, so $\frac{\partial f}{\partial t} = -rxe^{-rt}$, $\frac{\partial f}{\partial x} = e^{-rt}$ and $\frac{\partial^2 f}{\partial x^2} = 0$.  Using Ito's lemma I get
\begin{align*}
df(t,S(t)) & = -rS(t)e^{-rt}dt + e^{-rt}dS(t) \\
& = -rS(t)e^{-rt}dt + e^{-rt}[rS(t)dt + \sigma dW(t)] \\
& = e^{-rt}\sigma dW(t).
\end{align*}
Then
\begin{align*}
f(t,S(t)) & = f(0,S(0)) + \sigma \int_0^t e^{-rs} dW(s) \\
& = S(0) + \sigma \int_0^t e^{-rs} dW(s) \\
& = S(t)e^{-rt} \\
& \implies S(t) = S(0)e^{rt} + \sigma e^{rt} \int_0^t e^{-rs} dW(s).
\end{align*}
I now want to check my solution by differentiating $S(t)$ and verifying I obtain the original SDE, but I'm unsure how to treat the stochastic integral term when using Ito's lemma.  Specifically, I'd like to write a "dummy" function $f$ as I did for the SDE (I find this makes applying Ito's lemma more clear), but my best guess is $f(t,x) = S(0)e^{rt} + \sigma e^{rt} \int_0^t e^{-rs} dx$.  It is not clear to me what $\frac{\partial f}{\partial t}$, $\frac{\partial f}{\partial x}$ or $\frac{\partial^2 f}{\partial x^2}$ should be.  Thanks!
 A: Note that the random variable $\int_{0}^{t}e^{-rs}\text dW_r$ is not a function of solely $W_r$ but, rather, depends on the entire process $\{W_r\}_{0\leqslant r\leqslant t}$. This is why your choice of function, $$f(t,x) = S_0e^{rt} + \sigma e^{rt} \int_0^t e^{-rs} \text dx ,$$ is not a well-defined $C^{1,2}$ function (and hence, your intended version of Ito's lemma cannot be applied). Instead, we could try 

$$
f(t,x) = S_0e^{rt} + \sigma e^{rt}x\,,\tag{1}
$$

where $X_t = \int_{0}^{t}e^{-rs}\text dW_s$. Now we can apply your intended form of Ito's lemma:

$$
\text dS_t = \text df(t, X_t)=  \frac{\partial f}{\partial t}\text dt + \frac{\partial f}{\partial x}\text dX_t + \frac{1}{2}\frac{\partial^2 f}{\partial x^2}\text d\langle X \rangle_t\ \ .\tag{2}
$$

Notice, from (1), that the non-zero partial derivatives  are 
$\displaystyle \frac{\partial f}{\partial t} = rf\ $ and $\ \displaystyle \frac{\partial f}{\partial x} = \sigma e^{rt}$. Also, by definition of stochastic differential equations, $\text dX_t = e^{-rt}\text dW_t$. Therefore, using these in (2) implies 

$$ \text dS_t = rS_t\text dt + \sigma \text dW_t$$

A: Starting with $S(t) = S(0)e^{rt}+\sigma e^{rt}\int_0^t e^{-rs} dW(s)$, let's take the differential $dS$.  We have
$$\begin{align}
dS(t) & = S(0) \left( re^{rt}\;dt\right) +\left(\sigma re^{rt} \;dt\right) \; \int_0^t e^{-rs} dW(s)+\sigma e^{rt}\; \left(e^{-rt}\; dW(t)\right)\\
&=rS(t)\;dt+\sigma \;dW(t)
\end{align}$$
recovering the original SDE, since all higher-order terms are of $O(dt^{3/2})$.

If you want to use Ito's Lemma directly, then here, $f(S,t) = S$.  Thus, 
$$\begin{align}
df&=\frac{\partial f}{\partial t} \; dt + \frac{\partial f}{\partial S} \; dS + \frac12 \frac{\partial^2 f}{\partial S^2} \; dS^2 \\
&=0 \; dt+(1) \; dS+(0) \; dS^2 \\
&=rS(t)\; dt+\sigma \; dW(t)
\end{align}$$
