The clang static analyser is arguably a lot more powerful tool than either PVS or the MSVC, and gives detailed information how how it arrived at its conclusion, unlike the other two (example listed below).
Changed the WindowsStaticAnalyzer.VisualCpp enum to alias to a new entry, WindowsStaticAnalyzer.Default, which picks the default static analysis tool for the given working compiler.
Presently, only a subset of checkers is enabled. As of this CL, the analyzer reports a huge amount of issues, some of which are benign (such as knowingly de-referencing shared pointers when we're sure they're valid, although those could benefit from being changed to shared refs) and some real bugs, for example calls to virtual functions from constructors/destructors, memory leaks in Slate and what looks like a really tricky, potential free-after-use issue with TSharedRef. Until some of those issues are resolved, I wouldn't recommend enabling this as a analysis pass in lieu of MSVC or PVS. It can be run selectively on individual files for now, however.
Example output:
E:\dev\ue5_main1\Engine\Source\Developer\StandaloneRenderer\Private\Windows\D3D\SlateD3DIndexBuffer.cpp(85,4): warning: Potential leak of memory pointed to by 'SavedIndices' [cplusplus.NewDeleteLeaks]
LogSlateD3DRendererFailure(TEXT("FSlateD3DIndexBuffer::ResizeBuffer() - ID3D11Device::CreateBuffer"), Hr);
^
E:\dev\ue5_main1\Engine\Source\Developer\StandaloneRenderer\Private\Windows\D3D\SlateD3DIndexBuffer.cpp(45,6): note: Assuming 'NumIndices' is > field 'MaxNumIndices'
if( NumIndices > MaxNumIndices )
^~~~~~~~~~~~~~~~~~~~~~~~~~
E:\dev\ue5_main1\Engine\Source\Developer\StandaloneRenderer\Private\Windows\D3D\SlateD3DIndexBuffer.cpp(45,2): note: Taking true branch
if( NumIndices > MaxNumIndices )
^
E:\dev\ue5_main1\Engine\Source\Developer\StandaloneRenderer\Private\Windows\D3D\SlateD3DIndexBuffer.cpp(53,19): note: Memory is allocated
SavedIndices = new uint8[MaxNumIndices*sizeof(SlateIndex)];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E:\dev\ue5_main1\Engine\Source\Developer\StandaloneRenderer\Private\Windows\D3D\SlateD3DIndexBuffer.cpp(68,7): note: Assuming 'Hr' is < 0
if (SUCCEEDED(Hr))
^~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\winerror.h(28788,24): note: expanded from macro 'SUCCEEDED'
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
^~~~~~~~~~~~~~~~~~~~
E:\dev\ue5_main1\Engine\Source\Developer\StandaloneRenderer\Private\Windows\D3D\SlateD3DIndexBuffer.cpp(68,3): note: Taking false branch
if (SUCCEEDED(Hr))
^
E:\dev\ue5_main1\Engine\Source\Developer\StandaloneRenderer\Private\Windows\D3D\SlateD3DIndexBuffer.cpp(85,4): note: Potential leak of memory pointed to by 'SavedIndices'
LogSlateD3DRendererFailure(TEXT("FSlateD3DIndexBuffer::ResizeBuffer() - ID3D11Device::CreateBuffer"), Hr);
^
#rb Ben.Marsh
#jira none
#rnx
[CL 14765788 by halfdan ingvarsson in ue5-main branch]
Requires Visual Studio 2019 15.8 Preview 3, and targets to specify bEnableCppModules = true. Unsupported on other compilers.
Notes:
- Module interfaces need to be placed in .IXX files.
- Module/module dependencies are determined by a post-makefile/pre-build scan of all module interfaces using the compiler, and cause additional prerequisites to be inserted into the dependency graph before execution.
- Available module IFC search paths use normal UE module dependency rules.
- Header units are not currently supported.
- Regular C++ files cannot currently implement functions defined in module interfaces, due to the macros force included by UBT. These macros need to be placed in the global module fragment, but declaring a global module fragment must be done from the translation unit being compiled (making force-included headers invalid).
#rb none
[CL 14354539 by Ben Marsh in ue5-main branch]
1) Fix Visual Studio Profiling PerfAPI build script pathing for modern era of Visual Studio, add IDEDir to UBT for base path of PerfAPI lib/headers
2) Add initial support for Superluminal instrumentation API, if it's installed and -Superluminal is passed on the command line. Dial back color saturation a bit to go easier on the eyes (my eyes!!). This is WIP support, we are technically violating the API rules by feeding in changing strings to the same profile marker. So, with this change you can see the instrumentation markers in the timeline, but using all the event features in Superluminal causes weird artifacts like event strings changing as you use profiler features. Subsequent change will attempt to pry apart static and instance string data in the instrumentation, as this is a common trope across profilers (and non-PC platforms).
Updated FExternalProfiler API to forward along color information from the instrumentation. This is a minor breaking change as it's very unlikely there are direct callers of these APIs.
[CL 14321510 by geoff evans in ue5-main branch]
- Refactored SDK versioning into more formalized APIs for all platforms. Currently UBT will not error with bad versions, but that is coming.
- Turnkey updated to use new BuildUtilities
#rb ben.marsh
[CL 13733158 by Josh Adams in ue5-main branch]
- BuildScripts so builders won't compile it
- UBT platform registration and from being registered in UBT (so it won't show up in VS)
- PlatformInfo (so it can't triggered from Package/Launch On)
#rb ben.marsh
[CL 13546702 by Josh Adams in ue5-main branch]
- Removed the function to return a single TP, and wrapped the functionality in a simple single required function (platform just has to add TPs to an array, high level code manages init and cleanup of the array)
- Stripped unncessary code from all TPs
- Collapsed the desktop targetplatform modules into 1 per platform
- Renamed LinuxAArch64NoEditorTargetPlatfortm to LinuxAArch64TargetPlatform to match the other non-editor platforms
- Deleted AllDesktopPlatform
[CL 13502803 by Josh Adams in ue5-main branch]
Defaults to just using general analysis (which UE4 builds cleanly with), but other options can be configured by setting TargetRules.WindowsPlatform.PVS.ModeFlags or by setting TargetRules.WindowsPlatform.PVS.UseApplicationSettings = true to read from the PVS config file.
Based on PR #6730.
#rb none
#jira UE-89664
#ROBOMERGE-SOURCE: CL 12496329 in //UE4/Release-4.25/... via CL 12496331 via CL 12496343
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v673-12478461)
[CL 12496355 by ben marsh in Main branch]
#jira none
#rb none
[FYI] Matt.Hoffman, Michael.Forot, Ben.Marsh
#ROBOMERGE-SOURCE: CL 12226010 in //UE4/Release-4.25/... via CL 12226016
#ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v663-12210973)
[CL 12226037 by michael sartain in Main branch]
#jira none
#rb Ben.Marsh
[FYI] Andrew.Grant, Brandon.Schaefer
#ROBOMERGE-SOURCE: CL 12224860 in //UE4/Release-4.25/... via CL 12224862
#ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v663-12210973)
[CL 12224868 by michael sartain in Main branch]
#rb Steve.Smith
#rnx
#jira
#ROBOMERGE-SOURCE: CL 12167048 in //UE4/Release-4.25/... via CL 12167060
#ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v661-12148976)
[CL 12167071 by ben marsh in Main branch]
To embed a custom manifest, set the WindowsPlatform.ManifestFile to a vaild path in a *.Target.cs file. To disable the embedding of the default manifest, set it to null.
#rb none
#jira UE-88825, UE-87398
#ROBOMERGE-SOURCE: CL 11619014 in //UE4/Release-4.25/... via CL 11619045
#ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v655-11596533)
[CL 11619057 by ben marsh in Main branch]