Fixed the condition in Tuple.h to not include the MSVC static analyzer workaround when using the clang static analyzer.
Added a special flag in UBT to instruct clang to properly set the __clang_analyzer__ macro during static analysis.
#rb Marc.Audy, Ben.Marsh
#jira none
#rnx
[CL 14807991 by halfdan ingvarsson in ue5-main branch]
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]
This was using net framework specific apis, found corresponding apis under net core and switched to them.
#jira UE-103000
[CL 14763785 by Joakim Lindqvist in ue5-main branch]
- Improved GPF's SDK error printouts, with no more red error text, and just a list of bad platform SDKs, and a link to the log file to get the detailed information if desired
#rb ben.marsh
[CL 14475783 by Josh Adams in ue5-main branch]