The first two steps on Sourcetrail with Unreal Engine 4 - a quick primer suggest a working approach, until native support for JSON Compilation Database is added to the Unreal Build Tool.
Quoting the steps:
- Install a patched version of Bear from GitHub - TTimo/Bear at ttimo (note: ttimo branch)
- From a clean UE4 tree, capture a compilation database:
bear -o ./UE4Game.json ./Engine/Build/BatchFiles/Linux/Build.sh UE4Game Linux Development -disableunity -nopch
He points out two issues that currently block Bear from capturing UE4 builds correctly: