Skip to content

Enabling UE4 Static Analysis#

Manually through UE4#

  • Pass -StaticAnalyzer=VisualCPP (or PVSStudio) to UBT.exe build
  • Make sure to Do full build of project (clean then build)
  • Also make sure to disable XGE
  • Can also modify buildconfiguration.xml
    <!-- <StaticAnalyzer>PVSStudio</StaticAnalyzer> -->

Devops script#

Bash bbr --analyzer=PVSStudio

UBT Command line#

UnrealBuildTool.exe UE4Editor Win64 Development -staticanalyzer=pvsstudio
UnrealBuildTool.exe UE4Editor Win64 Development -staticanalyzer=visualcpp -nodebuginfo


Manually setting up PVS Studio for Static Analysis#

  • Download PVS Studio
  • Launch standalone.exe, go to Tools->Options->Registration
  • Name: PVS-Studio Free
  • Add the following comments to every .cpp file
    // This is an independent project of an individual developer. Dear PVS-Studio, please check it.
    // PVS-Studio Static Code Analyzer for C, C++, C#, and Java:
  • for now, you need to have Incredibuild disabled
  • go to BBProto.Build.cs and add BuildConfiguration.bAllowXGE = false;
  • Open a shell in the PVS Studio folder and run CLMonitor.exe monitor
  • Do a full build of BBProto project
  • Go back to the shell, and type CLMonitor.exe analyze -l "sample.plog"
  • Double clicking sample.plog should launch the analysis results in PVS Studio