bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, mib, jingham.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
The short names of each signal name and alias only exist as ConstStrings
in this one scenario. For example, GetShortName("SIGHUP") will just give
you "HUP". There's not a good reason the string "HUP" needs to be in the
ConstString StringPool, and that's true for just about every signal
name.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152582
Files:
lldb/include/lldb/Target/UnixSignals.h
lldb/source/Target/UnixSignals.cpp
Index: lldb/source/Target/UnixSignals.cpp
===================================================================
--- lldb/source/Target/UnixSignals.cpp
+++ lldb/source/Target/UnixSignals.cpp
@@ -195,10 +195,8 @@
return m_signals.find(signo) != m_signals.end();
}
-ConstString UnixSignals::GetShortName(ConstString name) const {
- if (name)
- return ConstString(name.GetStringRef().substr(3)); // Remove "SIG" from
name
- return name;
+llvm::StringRef UnixSignals::GetShortName(llvm::StringRef name) const {
+ return name.substr(3); // Remove "SIG" from name
}
int32_t UnixSignals::GetSignalNumberFromName(const char *name) const {
Index: lldb/include/lldb/Target/UnixSignals.h
===================================================================
--- lldb/include/lldb/Target/UnixSignals.h
+++ lldb/include/lldb/Target/UnixSignals.h
@@ -77,8 +77,6 @@
int32_t GetSignalAtIndex(int32_t index) const;
- ConstString GetShortName(ConstString name) const;
-
// We assume that the elements of this object are constant once it is
// constructed, since a process should never need to add or remove symbols as
// it runs. So don't call these functions anywhere but the constructor of
@@ -147,6 +145,8 @@
void Reset(bool reset_stop, bool reset_notify, bool reset_suppress);
};
+ llvm::StringRef GetShortName(llvm::StringRef name) const;
+
virtual void Reset();
typedef std::map<int32_t, Signal> collection;
Index: lldb/source/Target/UnixSignals.cpp
===================================================================
--- lldb/source/Target/UnixSignals.cpp
+++ lldb/source/Target/UnixSignals.cpp
@@ -195,10 +195,8 @@
return m_signals.find(signo) != m_signals.end();
}
-ConstString UnixSignals::GetShortName(ConstString name) const {
- if (name)
- return ConstString(name.GetStringRef().substr(3)); // Remove "SIG" from name
- return name;
+llvm::StringRef UnixSignals::GetShortName(llvm::StringRef name) const {
+ return name.substr(3); // Remove "SIG" from name
}
int32_t UnixSignals::GetSignalNumberFromName(const char *name) const {
Index: lldb/include/lldb/Target/UnixSignals.h
===================================================================
--- lldb/include/lldb/Target/UnixSignals.h
+++ lldb/include/lldb/Target/UnixSignals.h
@@ -77,8 +77,6 @@
int32_t GetSignalAtIndex(int32_t index) const;
- ConstString GetShortName(ConstString name) const;
-
// We assume that the elements of this object are constant once it is
// constructed, since a process should never need to add or remove symbols as
// it runs. So don't call these functions anywhere but the constructor of
@@ -147,6 +145,8 @@
void Reset(bool reset_stop, bool reset_notify, bool reset_suppress);
};
+ llvm::StringRef GetShortName(llvm::StringRef name) const;
+
virtual void Reset();
typedef std::map<int32_t, Signal> collection;
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits