diff options
author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2016-03-12 00:31:13 +0000 |
---|---|---|
committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2016-03-12 00:31:13 +0000 |
commit | 0e28a19683080268029b6b2ffbfe6d90b3985fc5 (patch) | |
tree | fd76110326ae6a625888dffef50d0c3c650af7a9 /lldb/source/Core/RegisterValue.cpp | |
parent | 4b4e75886ccfd5bc607926eddae5d7139cc28122 (diff) | |
download | bcm5719-llvm-0e28a19683080268029b6b2ffbfe6d90b3985fc5.tar.gz bcm5719-llvm-0e28a19683080268029b6b2ffbfe6d90b3985fc5.zip |
Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
llvm-svn: 263312
Diffstat (limited to 'lldb/source/Core/RegisterValue.cpp')
-rw-r--r-- | lldb/source/Core/RegisterValue.cpp | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/lldb/source/Core/RegisterValue.cpp b/lldb/source/Core/RegisterValue.cpp index f2a0d209f24..b715ca9a098 100644 --- a/lldb/source/Core/RegisterValue.cpp +++ b/lldb/source/Core/RegisterValue.cpp @@ -1,4 +1,4 @@ -//===-- RegisterValue.cpp ----------------------------------------*- C++ -*-===// +//===-- RegisterValue.cpp ---------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -11,7 +11,11 @@ // C Includes // C++ Includes +#include <vector> + // Other libraries and framework includes +#include "llvm/ADT/StringRef.h" + // Project includes #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Error.h" @@ -24,7 +28,6 @@ using namespace lldb; using namespace lldb_private; - bool RegisterValue::Dump (Stream *s, const RegisterInfo *reg_info, @@ -98,14 +101,12 @@ RegisterValue::Dump (Stream *s, return false; } - bool RegisterValue::GetData (DataExtractor &data) const { return data.SetData(GetBytes(), GetByteSize(), GetByteOrder()) > 0; } - uint32_t RegisterValue::GetAsMemoryData (const RegisterInfo *reg_info, void *dst, @@ -113,7 +114,7 @@ RegisterValue::GetAsMemoryData (const RegisterInfo *reg_info, lldb::ByteOrder dst_byte_order, Error &error) const { - if (reg_info == NULL) + if (reg_info == nullptr) { error.SetErrorString ("invalid register info argument."); return 0; @@ -163,7 +164,7 @@ RegisterValue::SetFromMemoryData (const RegisterInfo *reg_info, lldb::ByteOrder src_byte_order, Error &error) { - if (reg_info == NULL) + if (reg_info == nullptr) { error.SetErrorString ("invalid register info argument."); return 0; @@ -405,8 +406,6 @@ RegisterValue::SetValueFromData (const RegisterInfo *reg_info, DataExtractor &sr return error; } -#include "llvm/ADT/StringRef.h" -#include <vector> static inline void StripSpaces(llvm::StringRef &Str) { while (!Str.empty() && isspace(Str[0])) @@ -414,16 +413,19 @@ static inline void StripSpaces(llvm::StringRef &Str) while (!Str.empty() && isspace(Str.back())) Str = Str.substr(0, Str.size()-1); } + static inline void LStrip(llvm::StringRef &Str, char c) { if (!Str.empty() && Str.front() == c) Str = Str.substr(1); } + static inline void RStrip(llvm::StringRef &Str, char c) { if (!Str.empty() && Str.back() == c) Str = Str.substr(0, Str.size()-1); } + // Helper function for RegisterValue::SetValueFromCString() static bool ParseVectorEncoding(const RegisterInfo *reg_info, const char *vector_str, const uint32_t byte_size, RegisterValue *reg_value) @@ -457,17 +459,18 @@ ParseVectorEncoding(const RegisterInfo *reg_info, const char *vector_str, const reg_value->SetBytes(&(bytes.front()), byte_size, eByteOrderLittle); return true; } + Error RegisterValue::SetValueFromCString (const RegisterInfo *reg_info, const char *value_str) { Error error; - if (reg_info == NULL) + if (reg_info == nullptr) { error.SetErrorString ("Invalid register info argument."); return error; } - if (value_str == NULL || value_str[0] == '\0') + if (value_str == nullptr || value_str[0] == '\0') { error.SetErrorString ("Invalid c-string value string."); return error; @@ -574,7 +577,6 @@ RegisterValue::SetValueFromCString (const RegisterInfo *reg_info, const char *va return error; } - bool RegisterValue::SignExtend (uint32_t sign_bitpos) { @@ -742,9 +744,7 @@ RegisterValue::GetAsUInt128 (const llvm::APInt& fail_value, bool *success_ptr) c case 4: case 8: case 16: - { return llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, ((const type128 *)buffer.bytes)->x); - } } } break; @@ -837,7 +837,7 @@ RegisterValue::GetBytes () const case eTypeLongDouble: return m_scalar.GetBytes(); case eTypeBytes: return buffer.bytes; } - return NULL; + return nullptr; } void * @@ -856,7 +856,7 @@ RegisterValue::GetBytes () case eTypeLongDouble: return m_scalar.GetBytes(); case eTypeBytes: return buffer.bytes; } - return NULL; + return nullptr; } uint32_t @@ -878,7 +878,6 @@ RegisterValue::GetByteSize () const return 0; } - bool RegisterValue::SetUInt (uint64_t uint, uint32_t byte_size) { @@ -933,7 +932,6 @@ RegisterValue::SetBytes (const void *bytes, size_t length, lldb::ByteOrder byte_ } } - bool RegisterValue::operator == (const RegisterValue &rhs) const { @@ -1044,7 +1042,6 @@ RegisterValue::ClearBit (uint32_t bit) return false; } - bool RegisterValue::SetBit (uint32_t bit) { @@ -1089,4 +1086,3 @@ RegisterValue::SetBit (uint32_t bit) } return false; } - |