summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] Add missing include to ObjCLanguage.cpp to fix buildRaphael Isemann2019-11-121-0/+1
|
* [lldb] Check if we actually have a Clang type in ↵Raphael Isemann2019-11-121-1/+1
| | | | | | | | ObjCLanguage::GetPossibleFormattersMatches We call IsPossibleDynamicType but we also need to check if this is a Clang type, otherwise other languages with dynamic types (like Swift) might end up being interpreted as potential Obj-C dynamic types.
* [Symbol] Give ClangASTContext a PersistentExpressionState instead of a ↵Alex Langford2019-09-091-0/+1
| | | | | | | | | | | | | | | ClangPersistentVariables ClangASTContext doesn't use m_persistent_variables in a way specific to ClangPersistentVariables. Therefore, it should hold a unique pointer to PersistentExpressionState instead of a ClangPersistentVariablesUP. This also prevents you from pulling in a plugin header when including ClangASTContext.h Doing this exposed an implicit dependency in ObjCLanguage that was corrected by including ClangModulesDeclVendor.h llvm-svn: 371470
* [LanguageRuntime] Move ObjCLanguageRuntime into a pluginAlex Langford2019-07-151-1/+2
| | | | | | | | | | | | | | Summary: Following up to my CPPLanguageRuntime change, I'm moving ObjCLanguageRuntime into a plugin as well. Reviewers: JDevlieghere, compnerd, jingham, clayborg Subscribers: mgorny, arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D64763 llvm-svn: 366148
* [Symbol] Add DeclVendor::FindTypesAlex Langford2019-07-021-29/+15
| | | | | | | | | | | | | Summary: Following up on the plan I outlined in D63622, we can remove the dependence on clang in all the places where we only want to find the types from the DeclVendor. This means that currently DeclVendor depends on clang, but centralizing the dependency makes it easier to refactor cleanly. Differential Revision: https://reviews.llvm.org/D63853 llvm-svn: 364962
* [Target] Remove Process::GetObjCLanguageRuntimeAlex Langford2019-06-101-3/+2
| | | | | | | | | | | Summary: In an effort to make Process more language agnostic, I removed GetCPPLanguageRuntime from Process. I'm following up now with an equivalent change for ObjC. Differential Revision: https://reviews.llvm.org/D63052 llvm-svn: 362981
* [Breakpoint] Make breakpoint language agnosticAlex Langford2019-05-111-33/+36
| | | | | | | | | | | | | | | | | | | Summary: Breakpoint shouldn't need to depend on any specific details from a programming language. Currently the only language-specific detail it takes advantage of are the different qualified names an objective-c method name might have when adding a name lookup. This is reasonably generalizable. The current method name I introduced is "GetVariantMethodNames", which I'm not particularly tied to. If you have a better suggestion, please do let me know. Reviewers: JDevlieghere, jingham, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D61746 llvm-svn: 360509
* C.128 override, virtual keyword handlingRaphael Isemann2019-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: According to [C128] "Virtual functions should specify exactly one of `virtual`, `override`, or `final`", I've added override where a virtual function is overriden but the explicit `override` keyword was missing. Whenever both `virtual` and `override` were specified, I removed `virtual`. As C.128 puts it: > [...] writing more than one of these three is both redundant and > a potential source of errors. I anticipate a discussion about whether or not to add `override` to destructors but I went for it because of an example in [ISOCPP1000]. Let me repeat the comment for you here: Consider this code: ``` struct Base { virtual ~Base(){} }; struct SubClass : Base { ~SubClass() { std::cout << "It works!\n"; } }; int main() { std::unique_ptr<Base> ptr = std::make_unique<SubClass>(); } ``` If for some odd reason somebody removes the `virtual` keyword from the `Base` struct, the code will no longer print `It works!`. So adding `override` to destructors actively protects us from accidentally breaking our code at runtime. [C128]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c128-virtual-functions-should-specify-exactly-one-of-virtual-override-or-final [ISOCPP1000]: https://github.com/isocpp/CppCoreGuidelines/issues/1000#issuecomment-476951555 Reviewers: teemperor, JDevlieghere, davide, shafik Reviewed By: teemperor Subscribers: kwk, arphaman, kadircet, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61440 llvm-svn: 359868
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-101-4/+0
| | | | | | | | | | | | | | | | | | | | | | | 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
* [ObjCLanguage] Remove LLDB_DISABLE_PYTHON markers from the formatters.Davide Italiano2019-03-141-6/+0
| | | | llvm-svn: 356210
* Pass ConstString by value (NFC)Adrian Prantl2019-03-061-7/+7
| | | | | | | | | | | | | | | | | My apologies for the large patch. With the exception of ConstString.h itself it was entirely produced by sed. ConstString has exactly one const char * data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object. (This fixes rdar://problem/48640859 for the Apple folks) Differential Revision: https://reviews.llvm.org/D59030 llvm-svn: 355553
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [lldb] Add synthetic frontend for _NSCallStackArrayKuba Mracek2018-11-121-0/+7
| | | | | | | | An Obj-C array type _NSCallStackArray is used in NSException backtraces. This patch adds a synthetic frontend for _NSCallStackArray, which now correctly returns frame PCs. Differential Revision: https://reviews.llvm.org/D44081 llvm-svn: 346708
* Remove header grouping comments.Jonas Devlieghere2018-11-111-4/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* [LLDB] Added syntax highlighting supportRaphael Isemann2018-08-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds syntax highlighting support to LLDB. When enabled (and lldb is allowed to use colors), printed source code is annotated with the ANSI color escape sequences. So far we have only one highlighter which is based on Clang and is responsible for all languages that are supported by Clang. It essentially just runs the raw lexer over the input and then surrounds the specific tokens with the configured escape sequences. Reviewers: zturner, davide Reviewed By: davide Subscribers: labath, teemperor, llvm-commits, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D49334 llvm-svn: 338662
* [ObjC] Add dataformatter for NSDecimalNumberJonas Devlieghere2018-06-131-0/+4
| | | | | | | | | | This patch adds a data formatter for NSDecimalNumber. The latter is a Foundation object used for representing and performing arithmetic on base-10 numbers that bridges to Decimal. Differential revision: https://reviews.llvm.org/D48114 llvm-svn: 334638
* Fix/unify the spelling of Objective-C.Adrian Prantl2018-06-131-1/+1
| | | | llvm-svn: 334614
* Reflow paragraphs in comments.Adrian Prantl2018-04-301-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
* Updated NSNumber formatter for new internal representation.Sean Callanan2017-06-191-0/+5
| | | | | | <rdar://problem/32780109> llvm-svn: 305727
* Avoid invalid string access in ObjCLanguage::MethodName::SetNameStephane Sezer2017-06-051-1/+1
| | | | | | | | | | | | | | | | | Summary: Don't access `name[1] if the string is only of length 1. Avoids a crash/assertion failure when parsing the string `-`. Test Plan: Debug a swift binary, set a breakpoint, watch lldb not crash Original change by Paul Menage <menage@fb.com> Reviewers: lldb-commits, clayborg Differential Revision: https://reviews.llvm.org/D33853 llvm-svn: 304725
* Switch std::call_once to llvm::call_onceKamil Rytarowski2017-02-061-2/+4
| | | | | | | | | | | | | | | | | | | | | Summary: The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms. This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger. Sponsored by <The NetBSD Foundation> Reviewers: labath, joerg, emaste, mehdi_amini, clayborg Reviewed By: labath, clayborg Subscribers: #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D29288 llvm-svn: 294202
* Move classes from Core -> Utility.Zachary Turner2017-02-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
* Don't allow direct access to StreamString's internal buffer.Zachary Turner2016-11-161-6/+6
| | | | | | | | | | | | | | | This is a large API change that removes the two functions from StreamString that return a std::string& and a const std::string&, and instead provide one function which returns a StringRef. Direct access to the underlying buffer violates the concept of a "stream" which is intended to provide forward only access, and makes porting to llvm::raw_ostream more difficult in the future. Differential Revision: https://reviews.llvm.org/D26698 llvm-svn: 287152
* Add support to the ObjC type scavenger for finding types via debug infoEnrico Granata2016-11-031-1/+14
| | | | llvm-svn: 285941
* Add helpers for the notion of a type scavenger that is "either this or that" ↵Enrico Granata2016-11-011-50/+55
| | | | | | | | source, and one that is "both this and that" source Use the helper to rewrite the ObjC type lookup logic (first modules, then runtime) in terms of an either scavenger llvm-svn: 285736
* Convert UniqueCStringMap to use StringRef.Zachary Turner2016-10-061-28/+33
| | | | llvm-svn: 283494
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-768/+962
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Add NSTaggedPointerString to the table of data formattersEnrico Granata2016-06-291-0/+1
| | | | | | Fixes rdar://27002512 llvm-svn: 274164
* Remove even more of the data formatters that silently run codeEnrico Granata2016-04-081-5/+0
| | | | | | Fixes <rdar://problem/25629755> llvm-svn: 265849
* Remove more of the code-running ObjC data formatter supportEnrico Granata2016-04-011-0/+1
| | | | llvm-svn: 265181
* Make it so that the data formatter for NSError can see through a variable of ↵Enrico Granata2016-03-151-4/+1
| | | | | | type NSError**. Fixes rdar://25060684 llvm-svn: 263603
* Add an LLDB data formatter for single-element NSArray and NSDictionary Cocoa ↵Enrico Granata2016-02-291-0/+4
| | | | | | | | containers Fixes rdar://23715118 llvm-svn: 262254
* Fix Clang-tidy modernize-use-nullptr warnings in source/Plugins/Language; ↵Eugene Zelenko2016-02-291-2/+4
| | | | | | other minor fixes. llvm-svn: 262246
* Turns out, many people define structs named Point that do not share the same ↵Enrico Granata2015-12-181-1/+1
| | | | | | names that this formatter uses for fields; use the {} syntax to make it so that a failure to parse the summary doesn't cause the entire printout to fail llvm-svn: 256042
* Introduce a way for Languages to specify whether values of "reference types" ↵Enrico Granata2015-11-101-0/+12
| | | | | | | | | | are "nil" (not pointing to anything) or uninitialized (never made to point at anything) This latter determination may or may not be possible on a per-language basis; and neither is mandatory to implement for any language Use this knowledge in the ValueObjectPrinter to generalize the notion of IsObjCNil() and the respective printout llvm-svn: 252663
* Add data formatters for NSError and NSExceptionEnrico Granata2015-11-061-0/+6
| | | | llvm-svn: 252269
* Rationalization of includes in the data formatters codeEnrico Granata2015-10-201-0/+2
| | | | llvm-svn: 250798
* Fix Clang-tidy modernize-use-override warnings in source/Plugins/Language; ↵Eugene Zelenko2015-10-201-8/+10
| | | | | | | | other minor fixes. Differential Revision: http://reviews.llvm.org/D13876 llvm-svn: 250789
* Add a data formatter for __NSArray0, the type of empty arraysEnrico Granata2015-10-141-0/+2
| | | | llvm-svn: 250341
* This is the work I was building up to with my patches yesterdayEnrico Granata2015-10-071-0/+81
| | | | | | | | | Introduce the notion of Language-based formatter prefix/suffix This is meant for languages that share certain data types but present them in syntatically different ways, such that LLDB can now have language-based awareness of which of the syntax variations it has to present to the user when formatting those values This is goodness for new languages and interoperability, but is NFC for existing languages. As such, existing tests cover this llvm-svn: 249587
* Add hooks that enable NSSet, NSDictionary and NSString formatting to apply ↵Enrico Granata2015-10-021-0/+3
| | | | | | | | to other types beyond the well-known ones This is meant to support languages that can do some sort of bridging from<-->to these ObjC types via types that statically vend themselves as Cocoa types, but dynamically have an implementation that does not match any of our well-known types, but where an introspecting formatter can be vended by the bridged language llvm-svn: 249185
* Teach 'type lookup' to pull types from clang modules; also add a test caseEnrico Granata2015-10-021-16/+39
| | | | llvm-svn: 249117
* Fix Android build after r249047.Oleksiy Vyalov2015-10-011-1/+1
| | | | llvm-svn: 249055
* Add a 'type lookup' command. This command is meant to look up type ↵Enrico Granata2015-10-011-0/+88
| | | | | | | | | | information by name in a language-specific way. Currently, it only supports Objective-C - C++ types can be looked up through debug info via 'image lookup -t', whereas ObjC types via this command are looked up by runtime introspection This behavior is in line with type lookup's behavior in Xcode 7, but I am definitely open to feedback as to what makes the most sense here llvm-svn: 249047
* Fix CMake build.Chaoren Lin2015-09-141-0/+2
| | | | | | | - Typo: Coca.cpp -> Cocoa.cpp - Missing include. llvm-svn: 247628
* Move Objective-C data formatters to the Objective-C language plugin where ↵Enrico Granata2015-09-141-0/+319
| | | | | | they belong llvm-svn: 247627
* Data formatter candidate matches can be generated in a number of ways; ↵Enrico Granata2015-09-091-0/+37
| | | | | | | | | | language-based dynamic type discovery being one of them (for instance, this is what takes an 'id' and discovers that it truly is an __NSArrayI, so it should probably use the NSArray formatter) This used to be hardcoded in the FormatManager, but in a pluginized world that is not the right way to go So, move this step to the Language plugin such that appropriate language plugins for a type get a say about adding candidates to the formatters lookup tables llvm-svn: 247112
* Move more functionality from the LanguageRuntimes to the Languages.Jim Ingham2015-09-021-0/+232
| | | | llvm-svn: 246616
* Add a new type of plugin: Language pluginEnrico Granata2015-08-271-0/+68
The Language plugin is menat to answer language-specific questions that are not bound to the existence of a process. Those are still the domain of the LanguageRuntime plugin The Language plugin will, instead, answer questions such as providing language-specific data formatters or expression evaluation At the moment, the interface is hollowed out, and empty do-nothing plugins have been setup for ObjC, C++ and ObjC++ llvm-svn: 246212
OpenPOWER on IntegriCloud