File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -559,6 +559,20 @@ static bool findPath(const std::string &callId,
559559 return false ;
560560}
561561
562+ static std::string getInvalidValueString (CTU::FileInfo::InvalidValueType invalidValue)
563+ {
564+ using InvalidValueType = CTU::FileInfo::InvalidValueType;
565+ switch (invalidValue) {
566+ case InvalidValueType::null:
567+ return " null" ;
568+ case InvalidValueType::uninit:
569+ return " uninitialized" ;
570+ case InvalidValueType::bufferOverflow:
571+ return " accessed out of bounds" ;
572+ }
573+ cppcheck::unreachable ();
574+ }
575+
562576std::list<ErrorMessage::FileLocation> CTU::FileInfo::getErrorPath (InvalidValueType invalidValue,
563577 const CTU::FileInfo::UnsafeUsage &unsafeUsage,
564578 const std::map<std::string, std::list<const CTU::FileInfo::CallBase *>> &callsMap,
@@ -581,7 +595,7 @@ std::list<ErrorMessage::FileLocation> CTU::FileInfo::getErrorPath(InvalidValueTy
581595
582596 std::list<ErrorMessage::FileLocation> locationList;
583597
584- const std::string value1 = (invalidValue == InvalidValueType::null) ? " null " : " uninitialized " ;
598+ const std::string value1 = getInvalidValueString (invalidValue) ;
585599
586600 for (int index = 9 ; index >= 0 ; index--) {
587601 if (!path[index])
You can’t perform that action at this time.
0 commit comments