Is it logically correct to differentiate and check continuity of derivative without knowing before hand if the function is differentiable or not? Suppose I want to check if a certain function is differentiable or not in a certain domain of $x$. For example, if $$f(x)=\int_{0}^{x} t \sin(\frac{1}{t})dt$$ in $(0,π)$ then is it okay to directly differentiate $f(x)$ and check if $f′(x)$ is continuous? Or it would be wrong to differentiate using Leibniz rule without knowing if $f(x)$ is differentiable ?
 A: First of all understand that the symbol $$\int_{a}^{b}f(x)\,dx\tag{1}$$ represents the (Riemann) integral of a function $f$ on interval $[a, b]$. Thus the assumptions on $f$ are that $f$ is defined and bounded on $[a, b]$ and of course $f$ is (Riemann) integrable on $[a, b]$ for symbol $(1)$ to make any sense.
In most cases the function $f$ is usually given by a formula through which the image $f(x)$ of $x$ under $f$ can be evaluated by plugging. Thus in the current example we have $$f(x) = \int_{0}^{x}t\sin(1/t)\,dt\tag{2}$$ and here the formula $g(t) = t\sin(1/t)$ makes sense only when $t \neq 0$. But then in order for equation $(2)$ to make sense we must have $g$ defined in interval $[0, x]$. So it is important that we define $g(0)$ somehow. Here we have complete freedom as the value of a function at a finite number of points does not make any difference to its Riemann integral and hence we may define $g(0)$ to have any value we wish. It is because of this reason that normally no one bothers to specifically define the functions under integral sign at exceptional points.
Further note that $g(t)$ is continuous everywhere except for $t = 0$ and if we choose $g(0) = 0$ then $g$ is also continuous at $t = 0$. Let us take $g(0) = 0$ so that $g$ is continuous at $0$. Then by the First Fundamental Theorem of Calculus we have $f'(0) = g(0) = 0$. Next note that since the value of integral in $(2)$ is not dependent on the value of $g(0)$ so $f(x)$ is independent of $g(0)$ and therefore $f'(0) = 0$ independently of whatever value $g(0)$ is used.

Here we are lucky to have a function $g$ under integral sign for which $\lim_{t \to 0}g(t) = 0$ exists so that the function $g$ can be made continuous at $0$ by choosing $g(0) = 0$ and then we can apply the First Fundamental Theorem of Calculus to get $f'(0) = g'(0) = 0$. But consider the slightly tougher example where $$F(x) = \int_{0}^{x}\cos(1/t)\,dt\tag{3}$$ and here the function $G(t) = \cos (1/t)$ under integral sign has an essential discontinuity at $t = 0$ which can not be fixed by giving any value to $G(0)$. Thus the First Fundamental Theorem of Calculus is of no help here (at least in a direct manner) in evaluating $F'(0)$. In fact we don't even know if $F$ is differentiable at $0$.
The right approach here is tricky and based on another function $\phi(t) = t^{2}\sin(1/t), \phi(0) = 0$. The function $\phi$ is continuous and differentiable everywhere with $$\phi'(t) = 2t\sin(1/t) - \cos(1/t), \phi'(0) = 0$$ Consider the function $\psi(t) = 2t\sin (1/t), \psi(0) = 0$ which is continuous everywhere and also define $G(0) = 0$. Then we can see that $\phi'(t) = \psi(t) - G(t)$ for all $t$. Also note that $\phi'(t)$ is continuous everywhere except at $t = 0$ and bounded everywhere and hence it is Riemann integrable in any finite interval and then by the Second Fundamental Theorem of Calculus we have $$\phi(x) - \phi(0) = \int_{0}^{x}\phi'(t)\,dt = \int_{0}^{x}\psi(t)\,dt - \int_{0}^{x}G(t)\,dt$$ or $$\phi(x) = \int_{0}^{x}\psi(t)\,dt - F(x)$$ or $$F(x) = \int_{0}^{x}\psi(t)\,dt - \phi(x)$$ We can now note that $\psi(t)$ is continuous everywhere and $\phi(x)$ is differentiable everywhere and hence by the First Fundamental Theorem of Calculus $F(x)$ is differentiable everywhere with $$F'(x) = \psi(x) - \phi'(x)$$ Thus $$F'(x) = \cos(1/x), F'(0) = 0$$ Note that the relation $F'(x) = \cos(1/x)$ is available by direct use of the First Fundamental Theorem of Calculus on equation $(3)$, but it is rather difficult to evaluate $F'(0) = 0$ as we have shown above. In this case you also see that derivative $F'$ is discontinuous at $0$.

To answer your question in short, it is never possible to differentiate a function (or to check the continuity of derivative) without analyzing the situation properly. In most cases there are theorems which help us to conclude whether the function is differentiable or not and if differentiable then help us to calculate the derivative and finally check whether the derivative is continuous. Also note that these theorems (like say Leibniz Rule) have their hypotheses which need to be checked before applying the theorem so that it is not possible to use the theorems blindly. But in some exceptional circumstances there might not be theorems which are directly applicable and the problem requires some reasonable ingenuity and effort to get the desired solution.
A: Note that $\phi(x)=x\sin(1/x)$ is continuous on $(0,\pi)$.   In fact, it has a removable discontinuity at $0$ since $\lim_{x\to 0}x\sin(1/x)=0$.  As such, $\phi$ is Riemann integrable on $[0,\pi]$.
Let $f(x)$ be given by the integral
$$f(x)=\int_0^x t\sin(1/t)\,dt$$
Since $t\sin(1/t)$ is continuous we have
$$f'(x)=x\sin(1/x)$$
for $x\ne0$ and $f'(0)=0$ since 
$$f'(0)=\lim_{h\to 0}\frac{f(0+h)-f(0)}{h}=\lim_{h\to 0}\frac1h \int_0^h t\sin(1/t)\,dt=0$$  
