Show lifetime kind in output (#3285)
This commit is contained in:
parent
668b88d7c0
commit
f90b05ea7c
|
@ -1773,7 +1773,8 @@ void Token::printValueFlow(bool xml, std::ostream &out) const
|
||||||
out << "end=" << value.intvalue;
|
out << "end=" << value.intvalue;
|
||||||
break;
|
break;
|
||||||
case ValueFlow::Value::ValueType::LIFETIME:
|
case ValueFlow::Value::ValueType::LIFETIME:
|
||||||
out << "lifetime=" << "(" << value.tokvalue->expressionString() << ")";
|
out << "lifetime[" << ValueFlow::Value::toString(value.lifetimeKind) << "]=("
|
||||||
|
<< value.tokvalue->expressionString() << ")";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (value.indirect > 0)
|
if (value.indirect > 0)
|
||||||
|
|
|
@ -6916,6 +6916,22 @@ const char* ValueFlow::Value::toString(MoveKind moveKind)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* ValueFlow::Value::toString(LifetimeKind lifetimeKind)
|
||||||
|
{
|
||||||
|
switch (lifetimeKind) {
|
||||||
|
case LifetimeKind::Object:
|
||||||
|
return "Object";
|
||||||
|
case LifetimeKind::SubObject:
|
||||||
|
return "SubObject";
|
||||||
|
case LifetimeKind::Lambda:
|
||||||
|
return "Lambda";
|
||||||
|
case LifetimeKind::Iterator:
|
||||||
|
return "Iterator";
|
||||||
|
case LifetimeKind::Address:
|
||||||
|
return "Address";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
const ValueFlow::Value *ValueFlow::valueFlowConstantFoldAST(Token *expr, const Settings *settings)
|
const ValueFlow::Value *ValueFlow::valueFlowConstantFoldAST(Token *expr, const Settings *settings)
|
||||||
{
|
{
|
||||||
|
|
|
@ -323,11 +323,23 @@ namespace ValueFlow {
|
||||||
/** int value before implicit truncation */
|
/** int value before implicit truncation */
|
||||||
long long wideintvalue;
|
long long wideintvalue;
|
||||||
|
|
||||||
enum class LifetimeKind {Object, SubObject, Lambda, Iterator, Address} lifetimeKind;
|
enum class LifetimeKind {
|
||||||
|
// Pointer points to a member of lifetime
|
||||||
|
Object,
|
||||||
|
// A member of object points to the lifetime
|
||||||
|
SubObject,
|
||||||
|
// Lambda has captured lifetime(similiar to SubObject)
|
||||||
|
Lambda,
|
||||||
|
// Iterator points to the lifetime of a container(similiar to Object)
|
||||||
|
Iterator,
|
||||||
|
// A pointer that holds the address of the lifetime
|
||||||
|
Address
|
||||||
|
} lifetimeKind;
|
||||||
|
|
||||||
enum class LifetimeScope { Local, Argument, SubFunction } lifetimeScope;
|
enum class LifetimeScope { Local, Argument, SubFunction } lifetimeScope;
|
||||||
|
|
||||||
static const char* toString(MoveKind moveKind);
|
static const char* toString(MoveKind moveKind);
|
||||||
|
static const char* toString(LifetimeKind lifetimeKind);
|
||||||
|
|
||||||
/** How known is this value */
|
/** How known is this value */
|
||||||
enum class ValueKind {
|
enum class ValueKind {
|
||||||
|
|
Loading…
Reference in New Issue