A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
78 lines
2.3 KiB
C++
78 lines
2.3 KiB
C++
//===-- MICmnMIValueConst.cpp -----------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// In-house headers:
|
|
#include "MICmnMIValueConst.h"
|
|
|
|
// Instantiations:
|
|
const CMIUtilString CMICmnMIValueConst::ms_constStrDblQuote("\"");
|
|
|
|
//++
|
|
// Details: CMICmnMIValueConst constructor.
|
|
// Type: Method.
|
|
// Args: vString - (R) MI Const c-string value.
|
|
// Return: None.
|
|
// Throws: None.
|
|
//--
|
|
CMICmnMIValueConst::CMICmnMIValueConst(const CMIUtilString &vString)
|
|
: m_strPartConst(vString), m_bNoQuotes(false) {
|
|
BuildConst();
|
|
}
|
|
|
|
//++
|
|
// Details: CMICmnMIValueConst constructor.
|
|
// Type: Method.
|
|
// Args: vString - (R) MI Const c-string value.
|
|
// vbNoQuotes - (R) True = return string not surrounded with quotes,
|
|
// false = use quotes.
|
|
// Return: None.
|
|
// Throws: None.
|
|
//--
|
|
CMICmnMIValueConst::CMICmnMIValueConst(const CMIUtilString &vString,
|
|
const bool vbNoQuotes)
|
|
: m_strPartConst(vString), m_bNoQuotes(vbNoQuotes) {
|
|
BuildConst();
|
|
}
|
|
|
|
//++
|
|
// Details: CMICmnMIValueConst destructor.
|
|
// Type: Overrideable.
|
|
// Args: None.
|
|
// Return: None.
|
|
// Throws: None.
|
|
//--
|
|
CMICmnMIValueConst::~CMICmnMIValueConst() {}
|
|
|
|
//++
|
|
// Details: Build the Value Const data.
|
|
// Type: Method.
|
|
// Args: None.
|
|
// Return: MIstatus::success - Functional succeeded.
|
|
// MIstatus::failure - Functional failed.
|
|
// Throws: None.
|
|
//--
|
|
bool CMICmnMIValueConst::BuildConst() {
|
|
if (m_strPartConst.length() != 0) {
|
|
const CMIUtilString strValue(m_strPartConst.StripCREndOfLine());
|
|
if (m_bNoQuotes) {
|
|
m_strValue = strValue;
|
|
} else {
|
|
const char *pFormat = "%s%s%s";
|
|
m_strValue =
|
|
CMIUtilString::Format(pFormat, ms_constStrDblQuote.c_str(),
|
|
strValue.c_str(), ms_constStrDblQuote.c_str());
|
|
}
|
|
} else {
|
|
const char *pFormat = "%s%s";
|
|
m_strValue = CMIUtilString::Format(pFormat, ms_constStrDblQuote.c_str(),
|
|
ms_constStrDblQuote.c_str());
|
|
}
|
|
|
|
return MIstatus::success;
|
|
}
|