diff options
author | hjk <hjk@qt.io> | 2023-02-24 13:25:35 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2023-02-27 07:44:24 +0000 |
commit | be1f95082d6334da2625e73ec198797729a2b066 (patch) | |
tree | 49d632130eae9dd47c696cfcd46dcd5f9dddea28 | |
parent | 8ab0c965a49694ae25b35866854b0e312e0a2f39 (diff) | |
download | qt-creator-be1f95082d6334da2625e73ec198797729a2b066.tar.gz |
Debugger: Save a few cycles in WatchData
Change-Id: Id2fc21fcc917969fa2f31864f4ff91f4df8c19d2
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r-- | src/plugins/debugger/watchdata.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp index 4b64248e2f..329e58b88b 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 |