MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / update

Function update

lib/vf_analyzers.cpp:772–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

770 }
771
772 void update(Token* tok, Action a, Direction d) override {
773 ValueFlow::Value* value = getValue(tok);
774 if (!value)
775 return;
776 ValueFlow::Value localValue;
777 if (a.isSymbolicMatch()) {
778 // Make a copy of the value to modify it
779 localValue = *value;
780 value = &localValue;
781 isSameSymbolicValue(tok, &localValue);
782 }
783 if (a.isInternal())
784 internalUpdate(tok, *value, d);
785 // Read first when moving forward
786 if (d == Direction::Forward && a.isRead())
787 setTokenValue(tok, *value, getSettings());
788 if (a.isInconclusive())
789 (void)lowerToInconclusive();
790 if (a.isWrite() && tok->astParent()) {
791 writeValue(value, tok, d);
792 }
793 // Read last when moving in reverse
794 if (d == Direction::Reverse && a.isRead())
795 setTokenValue(tok, *value, getSettings());
796 }
797
798 ValuePtr<Analyzer> reanalyze(Token* /*tok*/, const std::string& /*msg*/) const override {
799 return {};

Callers 2

updateRecursiveMethod · 0.70
traverseMethod · 0.70

Calls 7

getValueFunction · 0.85
isSameSymbolicValueFunction · 0.85
internalUpdateFunction · 0.85
setTokenValueFunction · 0.85
writeValueFunction · 0.85
astParentMethod · 0.80
isInconclusiveMethod · 0.45

Tested by

no test coverage detected