Skip to content

Commit a05424d

Browse files
mstorsjotkrasnukha
authored andcommitted
Use in-class initialization instead of explicit constructor initialization for CMICmnLLDBDebugSessionInfo
This fixes this warning: ../src/MICmnLLDBDebugSessionInfo.cpp:55:7: warning: field 'm_bCreateTty' will be initialized after field 'm_nNextMiStoppointId' [-Wreorder-ctor] m_bCreateTty(false), m_nNextMiStoppointId(1UL) {} ^
1 parent f30d04d commit a05424d

File tree

2 files changed

+13
-27
lines changed

2 files changed

+13
-27
lines changed

src/MICmnLLDBDebugSessionInfo.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,6 @@
3737
#endif // _WIN32
3838
#define RETURNED_PATH_SEPARATOR "/"
3939

40-
//++
41-
// Details: CMICmnLLDBDebugSessionInfo constructor.
42-
// Type: Method.
43-
// Args: None.
44-
// Return: None.
45-
// Throws: None.
46-
//--
47-
CMICmnLLDBDebugSessionInfo::CMICmnLLDBDebugSessionInfo()
48-
: m_nBreakpointCntMax(INT32_MAX),
49-
m_currentSelectedThread(LLDB_INVALID_THREAD_ID),
50-
m_constStrSharedDataKeyWkDir("Working Directory"),
51-
m_constStrSharedDataSolibPath("Solib Path"),
52-
m_constStrPrintCharArrayAsString("Print CharArrayAsString"),
53-
m_constStrPrintExpandAggregates("Print ExpandAggregates"),
54-
m_constStrPrintAggregateFieldNames("Print AggregateFieldNames"),
55-
m_bCreateTty(false), m_nNextMiStoppointId(1UL) {}
56-
5740
//++
5841
// Details: CMICmnLLDBDebugSessionInfo destructor.
5942
// Type: Overridable.

src/MICmnLLDBDebugSessionInfo.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,21 @@ class CMICmnLLDBDebugSessionInfo
212212
// Attributes:
213213
public:
214214
// The following are available to all command instances
215-
const MIuint m_nBreakpointCntMax;
215+
const MIuint m_nBreakpointCntMax = INT32_MAX;
216216
VecActiveThreadId_t m_vecActiveThreadId;
217-
lldb::tid_t m_currentSelectedThread;
217+
lldb::tid_t m_currentSelectedThread = LLDB_INVALID_THREAD_ID;
218218

219219
// These are keys that can be used to access the shared data map
220220
// Note: This list is expected to grow and will be moved and abstracted in the
221221
// future.
222-
const CMIUtilString m_constStrSharedDataKeyWkDir;
223-
const CMIUtilString m_constStrSharedDataSolibPath;
224-
const CMIUtilString m_constStrPrintCharArrayAsString;
225-
const CMIUtilString m_constStrPrintExpandAggregates;
226-
const CMIUtilString m_constStrPrintAggregateFieldNames;
222+
const CMIUtilString m_constStrSharedDataKeyWkDir = "Working Directory";
223+
const CMIUtilString m_constStrSharedDataSolibPath = "Solib Path";
224+
const CMIUtilString m_constStrPrintCharArrayAsString =
225+
"Print CharArrayAsString";
226+
const CMIUtilString m_constStrPrintExpandAggregates =
227+
"Print ExpandAggregates";
228+
const CMIUtilString m_constStrPrintAggregateFieldNames =
229+
"Print AggregateFieldNames";
227230

228231
// Typedefs:
229232
private:
@@ -236,7 +239,7 @@ class CMICmnLLDBDebugSessionInfo
236239

237240
// Methods:
238241
private:
239-
/* ctor */ CMICmnLLDBDebugSessionInfo();
242+
/* ctor */ CMICmnLLDBDebugSessionInfo() = default;
240243
/* ctor */ CMICmnLLDBDebugSessionInfo(const CMICmnLLDBDebugSessionInfo &);
241244
void operator=(const CMICmnLLDBDebugSessionInfo &);
242245
//
@@ -269,10 +272,10 @@ class CMICmnLLDBDebugSessionInfo
269272
MapMiStoppointIdToStoppointInfo_t m_mapMiStoppointIdToStoppointInfo;
270273
CMIUtilThreadMutex m_sessionMutex;
271274
MapLldbStoppointIdToMiStoppointId_t m_mapLldbStoppointIdToMiStoppointId;
272-
MIuint m_nNextMiStoppointId;
275+
MIuint m_nNextMiStoppointId = 1UL;
273276
std::mutex m_miStoppointIdsMutex;
274277

275-
bool m_bCreateTty; // Created inferiors should launch with new TTYs
278+
bool m_bCreateTty = false; // Created inferiors should launch with new TTYs
276279
};
277280

278281
//++

0 commit comments

Comments
 (0)