Skip to content

Commit 18949d9

Browse files
authored
programmemory.cpp: avoid unnecessary copy of settings in evaluateLibraryFunction (danmar#6642)
1 parent 8368943 commit 18949d9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/programmemory.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,15 +1820,15 @@ ValueFlow::Value evaluateLibraryFunction(const std::unordered_map<nonneg int, Va
18201820
bool cpp)
18211821
{
18221822
thread_local static std::unordered_map<std::string,
1823-
std::function<ValueFlow::Value(const std::unordered_map<nonneg int, ValueFlow::Value>& arg)>>
1823+
std::function<ValueFlow::Value(const std::unordered_map<nonneg int, ValueFlow::Value>&, const Settings&)>>
18241824
functions = {};
18251825
if (functions.count(returnValue) == 0) {
18261826

18271827
std::unordered_map<nonneg int, const Token*> lookupVarId;
18281828
std::shared_ptr<Token> expr = createTokenFromExpression(returnValue, settings, cpp, lookupVarId);
18291829

18301830
functions[returnValue] =
1831-
[lookupVarId, expr, settings](const std::unordered_map<nonneg int, ValueFlow::Value>& xargs) {
1831+
[lookupVarId, expr](const std::unordered_map<nonneg int, ValueFlow::Value>& xargs, const Settings& settings) {
18321832
if (!expr)
18331833
return ValueFlow::Value::unknown();
18341834
ProgramMemory pm{};
@@ -1840,7 +1840,7 @@ ValueFlow::Value evaluateLibraryFunction(const std::unordered_map<nonneg int, Va
18401840
return execute(expr.get(), pm, settings);
18411841
};
18421842
}
1843-
return functions.at(returnValue)(args);
1843+
return functions.at(returnValue)(args, settings);
18441844
}
18451845

18461846
void execute(const Token* expr,

0 commit comments

Comments
 (0)