Fix clang-tidy readability-static-accessed-through-instance

The crash that was occurring with this check was fixed in clang 15.
This commit is contained in:
Robert Müller 2023-10-06 12:26:33 +02:00
parent 4e31052821
commit 5a10ef049a
8 changed files with 17 additions and 20 deletions

View file

@ -10,8 +10,6 @@
# TODO: Requires C11 to fix
# misc-unused-parameters
# TODO: Many changes
# readability-static-accessed-through-instance,
# Crashes: https://github.com/llvm/llvm-project/issues/53359
# misc-use-anonymous-namespace
# We don't want to use anonymous namespaces instead of static functions.
# bugprone-suspicious-realloc-usage
@ -87,7 +85,6 @@ Checks: >
-readability-named-parameter,
-readability-non-const-parameter,
-readability-simplify-boolean-expr,
-readability-static-accessed-through-instance,
-readability-suspicious-call-argument,
-readability-uppercase-literal-suffix,
performance-*,

View file

@ -1711,7 +1711,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
char aTmpBackendName[256];
auto IsInfoDefault = [](const SMenuBackendInfo &CheckInfo) {
return str_comp_nocase(CheckInfo.m_pBackendName, g_Config.ms_pGfxBackend) == 0 && CheckInfo.m_Major == g_Config.ms_GfxGLMajor && CheckInfo.m_Minor == g_Config.ms_GfxGLMinor && CheckInfo.m_Patch == g_Config.ms_GfxGLPatch;
return str_comp_nocase(CheckInfo.m_pBackendName, CConfig::ms_pGfxBackend) == 0 && CheckInfo.m_Major == CConfig::ms_GfxGLMajor && CheckInfo.m_Minor == CConfig::ms_GfxGLMinor && CheckInfo.m_Patch == CConfig::ms_GfxGLPatch;
};
int OldSelectedBackend = -1;

View file

@ -30,9 +30,9 @@ void CLayerQuads::Render(bool QuadPicker)
Graphics()->TextureSet(m_pEditor->m_Map.m_vpImages[m_Image]->m_Texture);
Graphics()->BlendNone();
m_pEditor->RenderTools()->ForceRenderQuads(m_vQuads.data(), m_vQuads.size(), LAYERRENDERFLAG_OPAQUE, m_pEditor->EnvelopeEval, m_pEditor);
m_pEditor->RenderTools()->ForceRenderQuads(m_vQuads.data(), m_vQuads.size(), LAYERRENDERFLAG_OPAQUE, CEditor::EnvelopeEval, m_pEditor);
Graphics()->BlendNormal();
m_pEditor->RenderTools()->ForceRenderQuads(m_vQuads.data(), m_vQuads.size(), LAYERRENDERFLAG_TRANSPARENT, m_pEditor->EnvelopeEval, m_pEditor);
m_pEditor->RenderTools()->ForceRenderQuads(m_vQuads.data(), m_vQuads.size(), LAYERRENDERFLAG_TRANSPARENT, CEditor::EnvelopeEval, m_pEditor);
}
CQuad *CLayerQuads::NewQuad(int x, int y, int Width, int Height)

View file

@ -40,7 +40,7 @@ void CLayerSounds::Render(bool Tileset)
if(Source.m_PosEnv >= 0)
{
ColorRGBA Channels;
m_pEditor->EnvelopeEval(Source.m_PosEnvOffset, Source.m_PosEnv, Channels, m_pEditor);
CEditor::EnvelopeEval(Source.m_PosEnvOffset, Source.m_PosEnv, Channels, m_pEditor);
OffsetX = Channels.r;
OffsetY = Channels.g;
}
@ -90,7 +90,7 @@ void CLayerSounds::Render(bool Tileset)
if(Source.m_PosEnv >= 0)
{
ColorRGBA Channels;
m_pEditor->EnvelopeEval(Source.m_PosEnvOffset, Source.m_PosEnv, Channels, m_pEditor);
CEditor::EnvelopeEval(Source.m_PosEnvOffset, Source.m_PosEnv, Channels, m_pEditor);
OffsetX = Channels.r;
OffsetY = Channels.g;
}

View file

@ -131,10 +131,10 @@ void CLayerTiles::Render(bool Tileset)
ColorRGBA Color = ColorRGBA(m_Color.r / 255.0f, m_Color.g / 255.0f, m_Color.b / 255.0f, m_Color.a / 255.0f);
Graphics()->BlendNone();
m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_OPAQUE,
m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset);
CEditor::EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset);
Graphics()->BlendNormal();
m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_TRANSPARENT,
m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset);
CEditor::EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset);
// Render DDRace Layers
if(!Tileset)

View file

@ -58,7 +58,7 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuFile(void *pContext, CUIRect Vie
pEditor->m_PopupEventActivated = true;
}
else
pEditor->InvokeFileDialog(IStorage::TYPE_ALL, FILETYPE_MAP, "Load map", "Load", "maps", false, pEditor->CallbackOpenMap, pEditor);
pEditor->InvokeFileDialog(IStorage::TYPE_ALL, FILETYPE_MAP, "Load map", "Load", "maps", false, CEditor::CallbackOpenMap, pEditor);
return CUI::POPUP_CLOSE_CURRENT;
}
@ -82,7 +82,7 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuFile(void *pContext, CUIRect Vie
View.HSplitTop(12.0f, &Slot, &View);
if(pEditor->DoButton_MenuItem(&s_AppendButton, "Append", 0, &Slot, 0, "Opens a map and adds everything from that map to the current one (ctrl+a)"))
{
pEditor->InvokeFileDialog(IStorage::TYPE_ALL, FILETYPE_MAP, "Append map", "Append", "maps", false, pEditor->CallbackAppendMap, pEditor);
pEditor->InvokeFileDialog(IStorage::TYPE_ALL, FILETYPE_MAP, "Append map", "Append", "maps", false, CEditor::CallbackAppendMap, pEditor);
return CUI::POPUP_CLOSE_CURRENT;
}
@ -97,7 +97,7 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuFile(void *pContext, CUIRect Vie
pEditor->m_PopupEventActivated = true;
}
else
pEditor->InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save", "maps", false, pEditor->CallbackSaveMap, pEditor);
pEditor->InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save", "maps", false, CEditor::CallbackSaveMap, pEditor);
return CUI::POPUP_CLOSE_CURRENT;
}
@ -105,7 +105,7 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuFile(void *pContext, CUIRect Vie
View.HSplitTop(12.0f, &Slot, &View);
if(pEditor->DoButton_MenuItem(&s_SaveAsButton, "Save As", 0, &Slot, 0, "Saves the current map under a new name (ctrl+shift+s)"))
{
pEditor->InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save", "maps", true, pEditor->CallbackSaveMap, pEditor);
pEditor->InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save", "maps", true, CEditor::CallbackSaveMap, pEditor);
return CUI::POPUP_CLOSE_CURRENT;
}
@ -113,7 +113,7 @@ CUI::EPopupMenuFunctionResult CEditor::PopupMenuFile(void *pContext, CUIRect Vie
View.HSplitTop(12.0f, &Slot, &View);
if(pEditor->DoButton_MenuItem(&s_SaveCopyButton, "Save Copy", 0, &Slot, 0, "Saves a copy of the current map under a new name (ctrl+shift+alt+s)"))
{
pEditor->InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save", "maps", true, pEditor->CallbackSaveCopyMap, pEditor);
pEditor->InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save", "maps", true, CEditor::CallbackSaveCopyMap, pEditor);
return CUI::POPUP_CLOSE_CURRENT;
}
@ -1578,7 +1578,7 @@ CUI::EPopupMenuFunctionResult CEditor::PopupImage(void *pContext, CUIRect View,
View.HSplitTop(5.0f, nullptr, &View);
View.HSplitTop(12.0f, &Slot, &View);
}
else if(pEditor->IsVanillaImage(pImg->m_aName))
else if(CEditor::IsVanillaImage(pImg->m_aName))
{
if(pEditor->DoButton_MenuItem(&s_ExternalButton, "Make external", 0, &Slot, 0, "Removes the image from the map file."))
{

View file

@ -2860,7 +2860,7 @@ void CGameContext::ConTunes(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
char aBuf[256];
for(int i = 0; i < pSelf->Tuning()->Num(); i++)
for(int i = 0; i < CTuningParams::Num(); i++)
{
float Value;
pSelf->Tuning()->Get(i, &Value);
@ -2899,7 +2899,7 @@ void CGameContext::ConTuneDumpZone(IConsole::IResult *pResult, void *pUserData)
char aBuf[256];
if(List >= 0 && List < NUM_TUNEZONES)
{
for(int i = 0; i < pSelf->TuningList()[List].Num(); i++)
for(int i = 0; i < CTuningParams::Num(); i++)
{
float Value;
pSelf->TuningList()[List].Get(i, &Value);

View file

@ -479,8 +479,8 @@ MapObject CreateMapObject(const CMapItemGroup *pLayerGroup, const int PosX, cons
for(int i = 0; i < 2; i++)
{
Ob.m_aaScreenOffset[i][0] = -Ob.ms_aStandardScreen[i];
Ob.m_aaScreenOffset[i][1] = Ob.ms_aStandardScreen[i];
Ob.m_aaScreenOffset[i][0] = -MapObject::ms_aStandardScreen[i];
Ob.m_aaScreenOffset[i][1] = MapObject::ms_aStandardScreen[i];
if(Ob.m_aSpeed[i] < 0)
std::swap(Ob.m_aaScreenOffset[i][0], Ob.m_aaScreenOffset[i][1]);
}