diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp index 4b64248e2f7..329e58b88b7 100644 --- a/src/plugins/debugger/watchdata.cpp +++ b/src/plugins/debugger/watchdata.cpp @@ -15,6 +15,10 @@ namespace Debugger::Internal { +const QStringView inameLocal = u"local."; +const QStringView inameWatch = u"watch."; +const QStringView inameInspect = u"inspect."; + bool isPointerType(const QStringView type) { return type.endsWith('*') || type.endsWith(u"* const"); @@ -308,7 +312,7 @@ void WatchItem::parseHelper(const GdbMi &input, bool maySort) if (mi.isValid()) { address = mi.toAddress(); if (exp.isEmpty()) { - if (iname.startsWith("local.") && iname.count('.') == 1) + if (iname.startsWith(inameLocal) && iname.count('.') == 1) // Solve one common case of adding 'class' in // *(class X*)0xdeadbeef for gdb. exp = name; @@ -505,7 +509,7 @@ bool WatchItem::isLocal() const if (arrayIndex >= 0) if (const WatchItem *p = parent()) return p->isLocal(); - return iname.startsWith("local."); + return iname.startsWith(inameLocal); } bool WatchItem::isWatcher() const @@ -513,7 +517,7 @@ bool WatchItem::isWatcher() const if (arrayIndex >= 0) if (const WatchItem *p = parent()) return p->isWatcher(); - return iname.startsWith("watch."); + return iname.startsWith(inameWatch); } bool WatchItem::isInspect() const @@ -521,7 +525,7 @@ bool WatchItem::isInspect() const if (arrayIndex >= 0) if (const WatchItem *p = parent()) return p->isInspect(); - return iname.startsWith("inspect."); + return iname.startsWith(inameInspect); } QString WatchItem::internalName() const