In order to use clang-format for formatting/indenting code in IDE we need to add some tricks which are never needed for clang-format itself.
Let's start with the option which keeps all existing line breaks when the flag is set. This option is available with extra parameter for reformat() function.
The next steps could be for example - adding dummy text to empty lines to indent them or applying format only for the code before the cursor (for incomplete code). There are much more tricks which could also be considered later.