diff options
Diffstat (limited to 'source/Utility/StructuredData.cpp')
-rw-r--r-- | source/Utility/StructuredData.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/source/Utility/StructuredData.cpp b/source/Utility/StructuredData.cpp index 55f003f245bf..76a141af40b6 100644 --- a/source/Utility/StructuredData.cpp +++ b/source/Utility/StructuredData.cpp @@ -12,14 +12,14 @@ #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/JSON.h" #include "lldb/Utility/Status.h" -#include "lldb/Utility/Stream.h" // for Stream +#include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" -#include "llvm/ADT/STLExtras.h" // for make_unique +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/MemoryBuffer.h" #include <cerrno> #include <cstdlib> #include <inttypes.h> -#include <limits> // for numeric_limits +#include <limits> using namespace lldb_private; @@ -33,11 +33,6 @@ static StructuredData::ObjectSP ParseJSONArray(JSONParser &json_parser); StructuredData::ObjectSP StructuredData::ParseJSONFromFile(const FileSpec &input_spec, Status &error) { StructuredData::ObjectSP return_sp; - if (!input_spec.Exists()) { - error.SetErrorStringWithFormatv("input file {0} does not exist.", - input_spec); - return return_sp; - } auto buffer_or_error = llvm::MemoryBuffer::getFile(input_spec.GetPath()); if (!buffer_or_error) { @@ -149,7 +144,7 @@ static StructuredData::ObjectSP ParseJSONValue(JSONParser &json_parser) { } StructuredData::ObjectSP StructuredData::ParseJSON(std::string json_text) { - JSONParser json_parser(json_text.c_str()); + JSONParser json_parser(json_text); StructuredData::ObjectSP object_sp = ParseJSONValue(json_parser); return object_sp; } @@ -174,11 +169,11 @@ StructuredData::Object::GetObjectForDotSeparatedPath(llvm::StringRef path) { if (this->GetType() == lldb::eStructuredDataTypeArray) { std::pair<llvm::StringRef, llvm::StringRef> match = path.split('['); - if (match.second.size() == 0) { + if (match.second.empty()) { return this->shared_from_this(); } errno = 0; - uint64_t val = strtoul(match.second.str().c_str(), NULL, 10); + uint64_t val = strtoul(match.second.str().c_str(), nullptr, 10); if (errno == 0) { return this->GetAsArray()->GetItemAtIndex(val); } @@ -231,7 +226,7 @@ void StructuredData::Float::Dump(Stream &s, bool pretty_print) const { } void StructuredData::Boolean::Dump(Stream &s, bool pretty_print) const { - if (m_value == true) + if (m_value) s.PutCString("true"); else s.PutCString("false"); |