some minor optimizations (#3057)
This commit is contained in:
parent
0df10c3cb5
commit
e8b8cfec78
|
@ -1414,7 +1414,7 @@ bool Library::isnoreturn(const Token *ftok) const
|
|||
return true;
|
||||
if (isNotLibraryFunction(ftok))
|
||||
return false;
|
||||
const std::map<std::string, FalseTrueMaybe>::const_iterator it = mNoReturn.find(getFunctionName(ftok));
|
||||
const std::unordered_map<std::string, FalseTrueMaybe>::const_iterator it = mNoReturn.find(getFunctionName(ftok));
|
||||
if (it == mNoReturn.end())
|
||||
return false;
|
||||
if (it->second == FalseTrueMaybe::Maybe)
|
||||
|
@ -1428,7 +1428,7 @@ bool Library::isnotnoreturn(const Token *ftok) const
|
|||
return false;
|
||||
if (isNotLibraryFunction(ftok))
|
||||
return false;
|
||||
const std::map<std::string, FalseTrueMaybe>::const_iterator it = mNoReturn.find(getFunctionName(ftok));
|
||||
const std::unordered_map<std::string, FalseTrueMaybe>::const_iterator it = mNoReturn.find(getFunctionName(ftok));
|
||||
if (it == mNoReturn.end())
|
||||
return false;
|
||||
if (it->second == FalseTrueMaybe::Maybe)
|
||||
|
|
|
@ -564,7 +564,7 @@ private:
|
|||
std::map<std::string, AllocFunc> mAlloc; // allocation functions
|
||||
std::map<std::string, AllocFunc> mDealloc; // deallocation functions
|
||||
std::map<std::string, AllocFunc> mRealloc; // reallocation functions
|
||||
std::map<std::string, FalseTrueMaybe> mNoReturn; // is function noreturn?
|
||||
std::unordered_map<std::string, FalseTrueMaybe> mNoReturn; // is function noreturn?
|
||||
std::map<std::string, std::string> mReturnValue;
|
||||
std::map<std::string, std::string> mReturnValueType;
|
||||
std::map<std::string, int> mReturnValueContainer;
|
||||
|
|
|
@ -7381,7 +7381,7 @@ void Tokenizer::simplifyVariableMultipleAssign()
|
|||
}
|
||||
|
||||
// Binary operators simplification map
|
||||
static const std::map<std::string, std::string> cAlternativeTokens = {
|
||||
static const std::unordered_map<std::string, std::string> cAlternativeTokens = {
|
||||
std::make_pair("and", "&&")
|
||||
, std::make_pair("and_eq", "&=")
|
||||
, std::make_pair("bitand", "&")
|
||||
|
@ -7437,7 +7437,7 @@ bool Tokenizer::simplifyCAlternativeTokens()
|
|||
if (!tok->isName())
|
||||
continue;
|
||||
|
||||
const std::map<std::string, std::string>::const_iterator cOpIt = cAlternativeTokens.find(tok->str());
|
||||
const std::unordered_map<std::string, std::string>::const_iterator cOpIt = cAlternativeTokens.find(tok->str());
|
||||
if (cOpIt != cAlternativeTokens.end()) {
|
||||
alt.push_back(tok);
|
||||
|
||||
|
@ -7474,7 +7474,7 @@ bool Tokenizer::simplifyCAlternativeTokens()
|
|||
return false;
|
||||
|
||||
for (Token *tok: alt) {
|
||||
const std::map<std::string, std::string>::const_iterator cOpIt = cAlternativeTokens.find(tok->str());
|
||||
const std::unordered_map<std::string, std::string>::const_iterator cOpIt = cAlternativeTokens.find(tok->str());
|
||||
if (cOpIt != cAlternativeTokens.end())
|
||||
tok->str(cOpIt->second);
|
||||
else if (tok->str() == "not")
|
||||
|
|
Loading…
Reference in New Issue