Enable clang-tidy performance-* checks

This commit is contained in:
def 2020-11-05 11:34:20 +01:00
parent 21d76ed31d
commit 312b9d3bd8
7 changed files with 18 additions and 14 deletions

View file

@ -26,4 +26,5 @@ Checks: >
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
modernize-loop-convert,
readability-qualified-auto,
performance-*,
HeaderFilterRegex: 'src/.*'

View file

@ -715,7 +715,7 @@ public:
if(FT_New_Memory_Face(m_FTLibrary, pBuf, Size, 0, &FallbackFont.m_FtFace) == 0)
{
dbg_msg("textrender", "loaded fallback font from '%s'", pFilename);
pFont->m_FtFallbackFonts.emplace_back(std::move(FallbackFont));
pFont->m_FtFallbackFonts.emplace_back(FallbackFont);
return true;
}

View file

@ -73,7 +73,7 @@ void sqlstr::AgoTimeToString(int AgoTime, char *pAgoString, int Size)
Seconds = aTimes[i];
str_copy(aName, aaNames[i], sizeof(aName));
Count = floor((float)AgoTime / (float)Seconds);
Count = std::floor((float)AgoTime / (float)Seconds);
if(Count != 0)
{
break;
@ -98,7 +98,7 @@ void sqlstr::AgoTimeToString(int AgoTime, char *pAgoString, int Size)
str_copy(aName2, aaNames[i + 1], sizeof(aName2));
// add second piece if it's greater than 0
int Count2 = floor((float)(AgoTime - (Seconds * Count)) / (float)Seconds2);
int Count2 = std::floor((float)(AgoTime - (Seconds * Count)) / (float)Seconds2);
if(Count2 != 0)
{

View file

@ -59,14 +59,14 @@ void CGhost::GetNetObjCharacter(CNetObj_Character *pChar, const CGhostCharacter
pChar->m_Tick = pGhostChar->m_Tick;
}
CGhost::CGhostPath::CGhostPath(CGhostPath &&Other) :
CGhost::CGhostPath::CGhostPath(CGhostPath &&Other) noexcept :
m_ChunkSize(Other.m_ChunkSize), m_NumItems(Other.m_NumItems), m_lChunks(std::move(Other.m_lChunks))
{
Other.m_NumItems = 0;
Other.m_lChunks.clear();
}
CGhost::CGhostPath &CGhost::CGhostPath::operator=(CGhostPath &&Other)
CGhost::CGhostPath &CGhost::CGhostPath::operator=(CGhostPath &&Other) noexcept
{
Reset(Other.m_ChunkSize);
m_NumItems = Other.m_NumItems;

View file

@ -68,8 +68,8 @@ private:
CGhostPath(const CGhostPath &Other) = delete;
CGhostPath &operator=(const CGhostPath &Other) = delete;
CGhostPath(CGhostPath &&Other);
CGhostPath &operator=(CGhostPath &&Other);
CGhostPath(CGhostPath &&Other) noexcept;
CGhostPath &operator=(CGhostPath &&Other) noexcept;
void Reset(int ChunkSize = 25 * 60); // one minute with default snap rate
void SetSize(int Items);

View file

@ -4,6 +4,7 @@
#include <atomic>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <engine/map.h>
@ -149,7 +150,7 @@ public:
struct CSqlInitData : ISqlData
{
CSqlInitData(std::shared_ptr<CScoreInitResult> pResult) :
m_pResult(pResult)
m_pResult(std::move(pResult))
{
}
std::shared_ptr<CScoreInitResult> m_pResult;
@ -161,7 +162,7 @@ struct CSqlInitData : ISqlData
struct CSqlPlayerRequest : ISqlData
{
CSqlPlayerRequest(std::shared_ptr<CScorePlayerResult> pResult) :
m_pResult(pResult)
m_pResult(std::move(pResult))
{
}
std::shared_ptr<CScorePlayerResult> m_pResult;
@ -177,7 +178,7 @@ struct CSqlPlayerRequest : ISqlData
struct CSqlRandomMapRequest : ISqlData
{
CSqlRandomMapRequest(std::shared_ptr<CScoreRandomMapResult> pResult) :
m_pResult(pResult)
m_pResult(std::move(pResult))
{
}
std::shared_ptr<CScoreRandomMapResult> m_pResult;
@ -191,7 +192,7 @@ struct CSqlRandomMapRequest : ISqlData
struct CSqlScoreData : ISqlData
{
CSqlScoreData(std::shared_ptr<CScorePlayerResult> pResult) :
m_pResult(pResult)
m_pResult(std::move(pResult))
{
}
virtual ~CSqlScoreData(){};
@ -224,7 +225,7 @@ struct CSqlTeamScoreData : ISqlData
struct CSqlTeamSave : ISqlData
{
CSqlTeamSave(std::shared_ptr<CScoreSaveResult> pResult) :
m_pResult(pResult)
m_pResult(std::move(pResult))
{
}
virtual ~CSqlTeamSave(){};
@ -241,7 +242,7 @@ struct CSqlTeamSave : ISqlData
struct CSqlTeamLoad : ISqlData
{
CSqlTeamLoad(std::shared_ptr<CScoreSaveResult> pResult) :
m_pResult(pResult)
m_pResult(std::move(pResult))
{
}
virtual ~CSqlTeamLoad(){};

View file

@ -6,6 +6,8 @@
#include <game/server/gamecontext.h>
#include <game/teamscore.h>
#include <utility>
class CGameTeams
{
int m_TeamState[MAX_CLIENTS];
@ -123,7 +125,7 @@ public:
void SetSaving(int TeamID, std::shared_ptr<CScoreSaveResult> SaveResult)
{
m_pSaveTeamResult[TeamID] = SaveResult;
m_pSaveTeamResult[TeamID] = std::move(SaveResult);
}
bool GetSaving(int TeamID)