diff options
Diffstat (limited to 'lldb/source/Plugins/Language')
12 files changed, 63 insertions, 75 deletions
diff --git a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp index 5e8f051dec9..82b7ac1675f 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp @@ -147,9 +147,8 @@ public: return child_sp; } - // return true if this object is now safe to use forever without - // ever updating again; the typical (and tested) answer here is - // 'false' + // return true if this object is now safe to use forever without ever + // updating again; the typical (and tested) answer here is 'false' bool Update() override { return false; } // maybe return false if the block pointer is, say, null diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 622b66d8de9..1aa48e4f248 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -120,10 +120,9 @@ static bool ReverseFindMatchingChars(const llvm::StringRef &s, static bool IsTrivialBasename(const llvm::StringRef &basename) { // Check that the basename matches with the following regular expression - // "^~?([A-Za-z_][A-Za-z_0-9]*)$" - // We are using a hand written implementation because it is significantly more - // efficient then - // using the general purpose regular expression library. + // "^~?([A-Za-z_][A-Za-z_0-9]*)$" We are using a hand written implementation + // because it is significantly more efficient then using the general purpose + // regular expression library. size_t idx = 0; if (basename.size() > 0 && basename[0] == '~') idx = 1; @@ -151,10 +150,9 @@ static bool IsTrivialBasename(const llvm::StringRef &basename) { } bool CPlusPlusLanguage::MethodName::TrySimplifiedParse() { - // This method tries to parse simple method definitions - // which are presumably most comman in user programs. - // Definitions that can be parsed by this function don't have return types - // and templates in the name. + // This method tries to parse simple method definitions which are presumably + // most comman in user programs. Definitions that can be parsed by this + // function don't have return types and templates in the name. // A::B::C::fun(std::vector<T> &) const size_t arg_start, arg_end; llvm::StringRef full(m_full.GetCString()); @@ -251,8 +249,8 @@ std::string CPlusPlusLanguage::MethodName::GetScopeQualifiedName() { } bool CPlusPlusLanguage::IsCPPMangledName(const char *name) { - // FIXME!! we should really run through all the known C++ Language - // plugins and ask each one if this is a C++ mangled name + // FIXME!! we should really run through all the known C++ Language plugins + // and ask each one if this is a C++ mangled name if (name == nullptr) return false; diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp index a992b72dc6c..b32fe958896 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp @@ -25,8 +25,8 @@ Optional<ParsedFunction> CPlusPlusNameParser::ParseAsFunctionDefinition() { m_next_token_index = 0; Optional<ParsedFunction> result(None); - // Try to parse the name as function without a return type specified - // e.g. main(int, char*[]) + // Try to parse the name as function without a return type specified e.g. + // main(int, char*[]) { Bookmark start_position = SetBookmark(); result = ParseFunctionImpl(false); @@ -34,8 +34,8 @@ Optional<ParsedFunction> CPlusPlusNameParser::ParseAsFunctionDefinition() { return result; } - // Try to parse the name as function with function pointer return type - // e.g. void (*get_func(const char*))() + // Try to parse the name as function with function pointer return type e.g. + // void (*get_func(const char*))() result = ParseFuncPtr(true); if (result) return result; @@ -183,13 +183,13 @@ bool CPlusPlusNameParser::ConsumeTemplateArgs() { Advance(); // Consuming template arguments is a bit trickier than consuming function - // arguments, because '<' '>' brackets are not always trivially balanced. - // In some rare cases tokens '<' and '>' can appear inside template arguments - // as arithmetic or shift operators not as template brackets. - // Examples: std::enable_if<(10u)<(64), bool> + // arguments, because '<' '>' brackets are not always trivially balanced. In + // some rare cases tokens '<' and '>' can appear inside template arguments as + // arithmetic or shift operators not as template brackets. Examples: + // std::enable_if<(10u)<(64), bool> // f<A<operator<(X,Y)::Subclass>> - // Good thing that compiler makes sure that really ambiguous cases of - // '>' usage should be enclosed within '()' brackets. + // Good thing that compiler makes sure that really ambiguous cases of '>' + // usage should be enclosed within '()' brackets. int template_counter = 1; bool can_open_template = false; while (HasMoreTokens() && template_counter > 0) { @@ -208,9 +208,9 @@ bool CPlusPlusNameParser::ConsumeTemplateArgs() { case tok::less: // '<' is an attempt to open a subteamplte // check if parser is at the point where it's actually possible, - // otherwise it's just a part of an expression like 'sizeof(T)<(10)'. - // No need to do the same for '>' because compiler actually makes sure - // that '>' always surrounded by brackets to avoid ambiguity. + // otherwise it's just a part of an expression like 'sizeof(T)<(10)'. No + // need to do the same for '>' because compiler actually makes sure that + // '>' always surrounded by brackets to avoid ambiguity. if (can_open_template) ++template_counter; can_open_template = false; @@ -388,10 +388,9 @@ void CPlusPlusNameParser::SkipFunctionQualifiers() { bool CPlusPlusNameParser::ConsumeBuiltinType() { bool result = false; bool continue_parsing = true; - // Built-in types can be made of a few keywords - // like 'unsigned long long int'. This function - // consumes all built-in type keywords without - // checking if they make sense like 'unsigned char void'. + // Built-in types can be made of a few keywords like 'unsigned long long + // int'. This function consumes all built-in type keywords without checking + // if they make sense like 'unsigned char void'. while (continue_parsing && HasMoreTokens()) { switch (Peek().getKind()) { case tok::kw_short: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index f6d1f18cb59..95e02a473cd 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -123,12 +123,11 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() { static ConstString g___i_("__i_"); - // this must be a ValueObject* because it is a child of the ValueObject we are - // producing children for - // it if were a ValueObjectSP, we would end up with a loop (iterator -> - // synthetic -> child -> parent == iterator) - // and that would in turn leak memory by never allowing the ValueObjects to - // die and free their memory + // this must be a ValueObject* because it is a child of the ValueObject we + // are producing children for it if were a ValueObjectSP, we would end up + // with a loop (iterator -> synthetic -> child -> parent == iterator) and + // that would in turn leak memory by never allowing the ValueObjects to die + // and free their memory m_pair_ptr = valobj_sp ->GetValueForExpressionPath( ".__i_.__ptr_->__value_", nullptr, nullptr, @@ -386,7 +385,8 @@ enum LibcxxStringLayoutMode { }; // this function abstracts away the layout and mode details of a libc++ string -// and returns the address of the data and the size ready for callers to consume +// and returns the address of the data and the size ready for callers to +// consume static bool ExtractLibcxxStringInfo(ValueObject &valobj, ValueObjectSP &location_sp, uint64_t &size) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp index 6407ae129ad..6066f14b18c 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp @@ -206,8 +206,7 @@ bool AbstractListFrontEnd::HasLoop(size_t count) { if (m_loop_detected == 0) { // This is the first time we are being run (after the last update). Set up - // the loop - // invariant for the first element. + // the loop invariant for the first element. m_slow_runner = ListEntry(m_head).next(); m_fast_runner = m_slow_runner.next(); m_loop_detected = 1; @@ -215,9 +214,8 @@ bool AbstractListFrontEnd::HasLoop(size_t count) { // Loop invariant: // Loop detection has been run over the first m_loop_detected elements. If - // m_slow_runner == - // m_fast_runner then the loop has been detected after m_loop_detected - // elements. + // m_slow_runner == m_fast_runner then the loop has been detected after + // m_loop_detected elements. const size_t steps_to_run = std::min(count, m_count); while (m_loop_detected < steps_to_run && m_slow_runner && m_fast_runner && m_slow_runner != m_fast_runner) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp index be96a6d95bc..8f82bdcbfd5 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp @@ -382,8 +382,8 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetChildAtIndex( return lldb::ValueObjectSP(); } } else { - // because of the way our debug info is made, we need to read item 0 first - // so that we can cache information used to generate other elements + // because of the way our debug info is made, we need to read item 0 + // first so that we can cache information used to generate other elements if (m_skip_size == UINT32_MAX) GetChildAtIndex(0); if (m_skip_size == UINT32_MAX) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp index 19b0e88b896..dde75971b25 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp @@ -71,8 +71,8 @@ ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetTuple() { ValueObjectSP obj_subchild_sp = obj_child_sp->GetChildMemberWithName(ConstString("_M_t"), true); - // if there is a _M_t subchild, the tuple is found in - // the obj_subchild_sp (for libstdc++ 6.0.23). + // if there is a _M_t subchild, the tuple is found in the obj_subchild_sp + // (for libstdc++ 6.0.23). if (obj_subchild_sp) { return obj_subchild_sp; } diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index 16de62b02e5..d787d86bfee 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -766,9 +766,9 @@ bool lldb_private::formatters::NSDateSummaryProvider( stream.Printf("0001-12-30 00:00:00 +0000"); return true; } - // this snippet of code assumes that time_t == seconds since Jan-1-1970 - // this is generally true and POSIXly happy, but might break if a library - // vendor decides to get creative + // this snippet of code assumes that time_t == seconds since Jan-1-1970 this + // is generally true and POSIXly happy, but might break if a library vendor + // decides to get creative time_t epoch = GetOSXEpoch(); epoch = epoch + (time_t)date_value; tm *tm_date = gmtime(&epoch); diff --git a/lldb/source/Plugins/Language/ObjC/NSError.cpp b/lldb/source/Plugins/Language/ObjC/NSError.cpp index 4365a12b54e..77721e2db32 100644 --- a/lldb/source/Plugins/Language/ObjC/NSError.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSError.cpp @@ -177,12 +177,11 @@ public: private: // the child here can be "real" (i.e. an actual child of the root) or - // synthetized from raw memory - // if the former, I need to store a plain pointer to it - or else a loop of - // references will cause this entire hierarchy of values to leak - // if the latter, then I need to store a SharedPointer to it - so that it only - // goes away when everyone else in the cluster goes away - // oh joy! + // synthetized from raw memory if the former, I need to store a plain pointer + // to it - or else a loop of references will cause this entire hierarchy of + // values to leak if the latter, then I need to store a SharedPointer to it - + // so that it only goes away when everyone else in the cluster goes away oh + // joy! ValueObject *m_child_ptr; ValueObjectSP m_child_sp; }; diff --git a/lldb/source/Plugins/Language/ObjC/NSException.cpp b/lldb/source/Plugins/Language/ObjC/NSException.cpp index 1da4f6de19a..c6970efae4d 100644 --- a/lldb/source/Plugins/Language/ObjC/NSException.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSException.cpp @@ -171,12 +171,11 @@ public: private: // the child here can be "real" (i.e. an actual child of the root) or - // synthetized from raw memory - // if the former, I need to store a plain pointer to it - or else a loop of - // references will cause this entire hierarchy of values to leak - // if the latter, then I need to store a SharedPointer to it - so that it only - // goes away when everyone else in the cluster goes away - // oh joy! + // synthetized from raw memory if the former, I need to store a plain pointer + // to it - or else a loop of references will cause this entire hierarchy of + // values to leak if the latter, then I need to store a SharedPointer to it - + // so that it only goes away when everyone else in the cluster goes away oh + // joy! ValueObject *m_child_ptr; ValueObjectSP m_child_sp; }; diff --git a/lldb/source/Plugins/Language/ObjC/NSString.cpp b/lldb/source/Plugins/Language/ObjC/NSString.cpp index 3b4edf68e06..0b12edb53d7 100644 --- a/lldb/source/Plugins/Language/ObjC/NSString.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSString.cpp @@ -256,8 +256,7 @@ bool lldb_private::formatters::NSStringSummaryProvider( uint64_t location = valobj_addr + 2 * ptr_size; if (!has_explicit_length) { // in this kind of string, the byte before the string content is a length - // byte - // so let's try and use it to handle the embedded NUL case + // byte so let's try and use it to handle the embedded NUL case Status error; explicit_length = process_sp->ReadUnsignedIntegerFromMemory(location, 1, 0, error); @@ -368,9 +367,7 @@ bool lldb_private::formatters::NSTaggedString_SummaryProvider( } // this is a fairly ugly trick - pretend that the numeric value is actually a - // char* - // this works under a few assumptions: - // little endian architecture + // char* this works under a few assumptions: little endian architecture // sizeof(uint64_t) > g_MaxNonBitmaskedLen if (len_bits <= g_MaxNonBitmaskedLen) { stream.Printf("%s", prefix.c_str()); diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp index ea2eec7b33b..95d2d047bb0 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -90,9 +90,8 @@ bool ObjCLanguage::MethodName::SetName(llvm::StringRef name, bool strict) { if (name.empty()) return IsValid(strict); - // If "strict" is true. then the method must be specified with a - // '+' or '-' at the beginning. If "strict" is false, then the '+' - // or '-' can be omitted + // If "strict" is true. then the method must be specified with a '+' or '-' + // at the beginning. If "strict" is false, then the '+' or '-' can be omitted bool valid_prefix = false; if (name.size() > 1 && (name[0] == '+' || name[0] == '-')) { @@ -134,8 +133,8 @@ const ConstString &ObjCLanguage::MethodName::GetClassName() { if (paren_pos) { m_class.SetCStringWithLength(class_start, paren_pos - class_start); } else { - // No '(' was found in the full name, we can definitively say - // that our category was valid (and empty). + // No '(' was found in the full name, we can definitively say that our + // category was valid (and empty). m_category_is_valid = true; const char *space_pos = strchr(full, ' '); if (space_pos) { @@ -164,8 +163,8 @@ const ConstString &ObjCLanguage::MethodName::GetClassNameWithCategory() { // contain a '(', then we can also fill in the m_class if (!m_class && strchr(m_class_category.GetCString(), '(') == nullptr) { m_class = m_class_category; - // No '(' was found in the full name, we can definitively say - // that our category was valid (and empty). + // No '(' was found in the full name, we can definitively say that + // our category was valid (and empty). m_category_is_valid = true; } } @@ -796,8 +795,8 @@ static void LoadObjCFormatters(TypeCategoryImplSP objc_category_sp) { objc_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("__NSTimeZone"), appkit_flags); - // CFAbsoluteTime is actually a double rather than a pointer to an object - // we do not care about the numeric value, since it is probably meaningless to + // CFAbsoluteTime is actually a double rather than a pointer to an object we + // do not care about the numeric value, since it is probably meaningless to // users appkit_flags.SetDontShowValue(true); AddCXXSummary(objc_category_sp, |