[Lldb-commits] [lldb] r284231 - [LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class
Vadim Macagon via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 14 05:58:03 PDT 2016
Author: enlight
Date: Fri Oct 14 07:58:02 2016
New Revision: 284231
URL: http://llvm.org/viewvc/llvm-project?rev=284231&view=rev
Log:
[LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class
Summary:
Placeholder c-strings don't need to be instance variables.
Reviewers: ki.stfu, abidh
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D25592
Modified:
lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.h
Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp?rev=284231&r1=284230&r2=284231&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp Fri Oct 14 07:58:02 2016
@@ -18,6 +18,9 @@
#include "MICmnMIValueTuple.h"
#include "MIUtilString.h"
+static const char *kUnknownValue = "??";
+static const char *kUnresolvedCompositeValue = "{...}";
+
//++
//------------------------------------------------------------------------------------
// Details: CMICmnLLDBUtilSBValue constructor.
@@ -32,8 +35,8 @@
CMICmnLLDBUtilSBValue::CMICmnLLDBUtilSBValue(
const lldb::SBValue &vrValue, const bool vbHandleCharType /* = false */,
const bool vbHandleArrayType /* = true */)
- : m_rValue(const_cast<lldb::SBValue &>(vrValue)), m_pUnkwn("??"),
- m_pComposite("{...}"), m_bHandleCharType(vbHandleCharType),
+ : m_rValue(const_cast<lldb::SBValue &>(vrValue)),
+ m_bHandleCharType(vbHandleCharType),
m_bHandleArrayType(vbHandleArrayType) {
m_bValidSBValue = m_rValue.IsValid();
}
@@ -80,7 +83,7 @@ CMIUtilString CMICmnLLDBUtilSBValue::Get
CMIUtilString CMICmnLLDBUtilSBValue::GetValue(
const bool vbExpandAggregates /* = false */) const {
if (!m_bValidSBValue)
- return m_pUnkwn;
+ return kUnknownValue;
CMICmnLLDBDebugSessionInfo &rSessionInfo(
CMICmnLLDBDebugSessionInfo::Instance());
@@ -98,7 +101,7 @@ CMIUtilString CMICmnLLDBUtilSBValue::Get
return value;
if (!vbExpandAggregates && !bPrintExpandAggregates)
- return m_pComposite;
+ return kUnresolvedCompositeValue;
bool bPrintAggregateFieldNames = false;
bPrintAggregateFieldNames =
@@ -110,7 +113,7 @@ CMIUtilString CMICmnLLDBUtilSBValue::Get
CMICmnMIValueTuple miValueTuple;
const bool bOk = GetCompositeValue(bPrintAggregateFieldNames, miValueTuple);
if (!bOk)
- return m_pUnkwn;
+ return kUnknownValue;
value = miValueTuple.GetString();
return value;
@@ -131,11 +134,11 @@ bool CMICmnLLDBUtilSBValue::GetSimpleVal
CMIUtilString &vwrValue) const {
const MIuint nChildren = m_rValue.GetNumChildren();
if (nChildren == 0) {
- vwrValue = GetValueSummary(!m_bHandleCharType && IsCharType(), m_pUnkwn);
+ vwrValue = GetValueSummary(!m_bHandleCharType && IsCharType(), kUnknownValue);
return MIstatus::success;
} else if (IsPointerType()) {
vwrValue =
- GetValueSummary(!m_bHandleCharType && IsPointeeCharType(), m_pUnkwn);
+ GetValueSummary(!m_bHandleCharType && IsPointeeCharType(), kUnknownValue);
return MIstatus::success;
} else if (IsArrayType()) {
CMICmnLLDBDebugSessionInfo &rSessionInfo(
@@ -187,13 +190,13 @@ bool CMICmnLLDBUtilSBValue::GetComposite
miValueTuple, vnDepth + 1);
if (!bOk)
// Can't obtain composite type
- value = m_pUnkwn;
+ value = kUnknownValue;
else
// OK. Value is composite and was successfully got
value = miValueTuple.GetString();
} else {
// Need to get value from composite type, but vnMaxDepth is reached
- value = m_pComposite;
+ value = kUnresolvedCompositeValue;
}
const bool bNoQuotes = true;
const CMICmnMIValueConst miValueConst(value, bNoQuotes);
@@ -404,7 +407,7 @@ CMICmnLLDBUtilSBValue::ReadCStringFromHo
const MIuint64 nReadBytes =
process.ReadMemory(addr, &ch, sizeof(ch), error);
if (error.Fail() || nReadBytes != sizeof(ch))
- return m_pUnkwn;
+ return kUnknownValue;
else if (ch == 0)
break;
result.append(
@@ -425,7 +428,7 @@ CMICmnLLDBUtilSBValue::ReadCStringFromHo
//--
bool CMICmnLLDBUtilSBValue::IsNameUnknown() const {
const CMIUtilString name(GetName());
- return (name == m_pUnkwn);
+ return (name == kUnknownValue);
}
//++
@@ -438,7 +441,7 @@ bool CMICmnLLDBUtilSBValue::IsNameUnknow
//--
bool CMICmnLLDBUtilSBValue::IsValueUnknown() const {
const CMIUtilString value(GetValue());
- return (value == m_pUnkwn);
+ return (value == kUnknownValue);
}
//++
@@ -451,7 +454,7 @@ bool CMICmnLLDBUtilSBValue::IsValueUnkno
//--
CMIUtilString CMICmnLLDBUtilSBValue::GetTypeName() const {
const char *pName = m_bValidSBValue ? m_rValue.GetTypeName() : nullptr;
- const CMIUtilString text((pName != nullptr) ? pName : m_pUnkwn);
+ const CMIUtilString text((pName != nullptr) ? pName : kUnknownValue);
return text;
}
@@ -466,7 +469,7 @@ CMIUtilString CMICmnLLDBUtilSBValue::Get
//--
CMIUtilString CMICmnLLDBUtilSBValue::GetTypeNameDisplay() const {
const char *pName = m_bValidSBValue ? m_rValue.GetDisplayTypeName() : nullptr;
- const CMIUtilString text((pName != nullptr) ? pName : m_pUnkwn);
+ const CMIUtilString text((pName != nullptr) ? pName : kUnknownValue);
return text;
}
Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.h?rev=284231&r1=284230&r2=284231&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.h Fri Oct 14 07:58:02 2016
@@ -70,8 +70,6 @@ private:
// Attributes:
private:
lldb::SBValue &m_rValue;
- const char *m_pUnkwn;
- const char *m_pComposite;
bool m_bValidSBValue; // True = SBValue is a valid object, false = not valid.
bool m_bHandleCharType; // True = Yes return text molding to char type, false
// = just return data.
More information about the lldb-commits
mailing list