summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime/ObjC
Commit message (Collapse)AuthorAgeFilesLines
* [LanguageRuntime] Retire an unused member function. NFCI.Davide Italiano2020-01-134-42/+0
|
* Remove extraneous spacesMed Ismail Bennani2020-01-071-1/+1
| | | | Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb][NFC] Take a llvm::Triple in ClangASTContext constructorRaphael Isemann2020-01-072-6/+2
| | | | | | This constructor is supposed to take a string representing an llvm::Triple. We might as well take a llvm::Triple here which saves us all the string conversions in the call sites and we make this more type safe.
* [lldb][NFC] Create type-safe function for creating a CompilerType from a ↵Raphael Isemann2020-01-021-3/+2
| | | | | | | | | | | | | | | | | | | | | | QualType LLDB frequently converts QualType to CompilerType. This is currently done like this: result = CompilerType(this, qual_type_var.getAsOpaquePtr()) There are a few shortcomings in this current approach: 1. CompilerType's constructor takes a void* pointer so it isn't type safe. 2. We can't add any sanity checks to the CompilerType constructor (e.g. that the type actually belongs to the passed ClangASTContext) without expanding the TypeSystem API. 3. The logic for converting QualType->CompilerType is spread out over all of LLDB so changing it is difficult (e.g., what if we want to just pass the type ptr and not the 1type_ptr | qual_flags1 to CompilerType). This patch adds a `ClangASTContext::GetType` function similar to the other GetTypeForDecl functions that does this conversion in a type safe way. It also adds a sanity check for Tag-based types that the type actually belongs to the current ClangASTContext (Types don't seem to know their ASTContext, so we have to workaround by looking at the decl for the underlying TagDecl. This doesn't cover all types we construct but it's better than no sanity check).
* [lldb][NFC] Remove GetASTContext call in ClangDeclVendorRaphael Isemann2019-12-282-7/+6
| | | | | | | | Instead of returning NamedDecls and then calling GetASTContext to find back the ClangASTContext we used can just implement the FindDecl variant that returns CompilerDecls (and implement the other function by throwing away the ClangASTContext part of the compiler decl).
* [lldb][NFC] Use ClangASTContext in AppleObjCRuntime interfacesRaphael Isemann2019-12-265-61/+46
| | | | | | | This code actually needs a ClangASTContext but instead takes a clang::ASTContext and then retrieves the original ClangASTContext via the global map of ClangASTContexts. Let's change it so that it takes a ClangASTContext which is simpler and faster.
* [lldb][NFC] Remove ClangExternalASTSourceCommonRaphael Isemann2019-12-241-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | ClangExternalASTSourceCommon's purpose is to store a map from Decl*/Type* to ClangASTMetadata. Usually this data is accessed via the ClangASTContext interface which then grabs the current ExternalASTSource of its ASTContext, tries to cast it to ClangExternalASTSourceCommon and then accesses the metadata map. If the casting fails the setter does nothing and the getter returns a nullptr as if there was no known metadata for a type/decl. This system breaks as soon as any non-LLDB ExternalASTSource is added via a multiplexer to our existing ExternalASTSource (in which case we suddenly loose all out metadata as the casting always fails with an ExternalASTSource that is not inheriting from ClangExternalASTSourceCommon). This patch moves the metadata map to the ClangASTContext. This gets rid of all the fragile casting, the requirement that every ExternalASTSource in LLDB has to inherit from ClangExternalASTSourceCommon and simplifies the metadata implementation to a simple map lookup. As ClangExternalASTSourceCommon had no other purpose than storing metadata, this patch deletes this class and replaces all uses with clang::ExternalASTSource. No other code changes in this commit beside the AppleObjCDeclVendor which was the only code that did not use the ClangASTContext interface but directly accessed the ClangExternalASTSourceCommon.
* [lldb][NFC] Return a reference from ClangASTContext::getASTContext and ↵Raphael Isemann2019-12-212-22/+19
| | | | | | | | | | | remove dead nullptr checks ClangASTContext::getASTContext() currently returns a ptr but we have an assert there since a while that the ASTContext is not a nullptr. This causes that we still have a lot of code that is doing nullptr checks on the result of getASTContext() which is all unreachable code. This patch changes the return value to a reference to make it clear this can't be a nullptr and deletes all the nullptr checks.
* [lldb][NFC] Use StringRef in CreateRecordType and CreateObjCClassRaphael Isemann2019-12-171-1/+1
|
* [lldb] Remove modern-type-lookupRaphael Isemann2019-12-172-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed on the mailing list [1] we have to make a decision for how to proceed with the modern-type-lookup. This patch removes modern-type-lookup from LLDB. This just removes all the code behind the modern-type-lookup setting but it does *not* remove any code from Clang (i.e., the ExternalASTMerger and the clang-import-test stay around for now). The motivation for this is that I don't think that the current approach of implementing modern-type-lookup will work out. Especially creating a completely new lookup system behind some setting that is never turned on by anyone and then one day make one big switch to the new system seems wrong. It doesn't fit into the way LLVM is developed and has so far made the transition work much more complicated than it has to be. A lot of the benefits that were supposed to come with the modern-type-lookup are related to having a better organization in the way types move across LLDB and having less dependencies on unrelated LLDB code. By just looking at the current code (mostly the ClangASTImporter) I think we can reach the same goals by just incrementally cleaning up, documenting, refactoring and actually testing the existing code we have. [1] http://lists.llvm.org/pipermail/lldb-dev/2019-December/015831.html Reviewers: shafik, martong Subscribers: rnkovacs, christof, arphaman, JDevlieghere, usaxena95, lldb-commits, friss Tags: #lldb Differential Revision: https://reviews.llvm.org/D71562
* [Target] Remove Target::GetScratchClangASTContextAlex Langford2019-12-123-13/+32
| | | | | | | Target doesn't really need to know about ClangASTContext more than any other TypeSystem. We can create a method ClangASTContext::GetScratch for anything who needs a ClangASTContext specifically instead of just a generic TypeSystem.
* [lldb] Use llvm::format in AppleObjCRuntimeV2.cppPavel Labath2019-11-261-8/+2
| | | | Crushing a "sprintf" buffer is null warning.
* [lldb] Remove lldb's own ASTDumperRaphael Isemann2019-11-251-40/+24
| | | | | | | | | | | | | | | | | | | | | Summary: LLDB's ASTDumper is just a clone of Clang's ASTDumper but with some scary code and some unrelated functionality (like dumping name/attributes of types). This removes LLDB's ASTDumper and replaces its uses with the `ClangUtils::DumpDecl` method that just calls Clang's ASTDumper and returns the result as a string. The few uses where we just want a textual representation of a type (which will print their name/attributes but not dump any AST) are now also in ClangUtil under a `ToString` name until we find a better home for them. Reviewers: labath Reviewed By: labath Subscribers: mgorny, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70663
* Adapt LLDB to clang API change in ObjCMethodDecl::create().Adrian Prantl2019-11-081-3/+4
|
* [lldb] Adjust for the new class_rw_t layout.Jonas Devlieghere2019-10-221-0/+12
| | | | | | | | | The field holding the "ro" will now be a union. If the low bit is set, then it isn't an ro and it needs to be dereferenced once more to get to it. If the low bit isn't set, then it is a proper class_ro_t No dedicated test is needed as this code path will trigger when running the existing Objective-C tests under a current version of the runtime.
* Modernize the rest of the Find.* API (NFC)Adrian Prantl2019-10-173-13/+19
| | | | | | | | | | | | This patch removes the size_t return value and the append parameter from the remainder of the Find.* functions in LLDB's internal API. As in the previous patches, this is motivated by the fact that these parameters aren't really used, and in the case of the append parameter were frequently implemented incorrectly. Differential Revision: https://reviews.llvm.org/D69119 llvm-svn: 375160
* Replace static const StringRef with StringRef (NFC)Adrian Prantl2019-10-081-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D68597 llvm-svn: 374081
* [lldb] [cmake] Support linking against clang-cpp dylibMichal Gorny2019-10-041-1/+2
| | | | | | | | | Link against clang-cpp dylib rather than split libs when CLANG_LINK_CLANG_DYLIB is enabled. Differential Revision: https://reviews.llvm.org/D68456 llvm-svn: 373734
* Remove size_t return parameter from FindTypesAdrian Prantl2019-10-011-14/+11
| | | | | | | | | | | | | | | In r368345 I accidentally introduced a regression that would over-report the number of matches found by FindTypes if the DeclContext Filter was hit. This patch simply removes the size_t return parameter altogether — it's not that useful. rdar://problem/55500457 Differential Revision: https://reviews.llvm.org/D68169 llvm-svn: 373344
* [clang][lldb][NFC] Encapsulate ExternalASTMerger::ImporterSourceRaphael Isemann2019-10-011-4/+3
| | | | | | NFC preparation work for upcoming ExternalASTMerger patches. llvm-svn: 373312
* remove File::SetStream(), make new files instead.Lawrence D'Anna2019-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch removes File::SetStream() and File::SetDescriptor(), and replaces most direct uses of File with pointers to File. Instead of calling SetStream() on a file, we make a new file and replace it. My ultimate goal here is to introduce a new API class SBFile, which has full support for python io.IOStream file objects. These can redirect read() and write() to python code, so lldb::Files will need a way to dispatch those methods. Additionally it will need some form of sharing and assigning files, as a SBFile will be passed in and assigned to the main IO streams of the debugger. In my prototype patch queue, I make File itself copyable and add a secondary class FileOps to manage the sharing and dispatch. In that case SBFile was a unique_ptr<File>. (here: https://github.com/smoofra/llvm-project/tree/files) However in review, Pavel Labath suggested that it be shared_ptr instead. (here: https://reviews.llvm.org/D67793) In order for SBFile to use shared_ptr<File>, everything else should as well. If this patch is accepted, I will make SBFile use a shared_ptr I will remove FileOps from future patches and use subclasses of File instead. Reviewers: JDevlieghere, jasonmolenda, zturner, jingham, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67891 llvm-svn: 373090
* Update name of objc runtime SPI function we call for class names.Jason Molenda2019-08-281-1/+1
| | | | | | | | | | A new SPI was added to the objc runtime to get class names without any demangling; AppleObjCRuntimeV2::ParseClassInfoArray was using the original prototype name but had not been updated for the final name yet, so lldb was falling back to the old function and doing extra work for classes that were demangled. This commit fixes that. llvm-svn: 370152
* [Symbol] Decouple clang from DeclVendorAlex Langford2019-08-231-0/+1
| | | | | | | | | | Summary: This removes DeclVendor's dependency on clang (and ClangASTContext). DeclVendor has no need to know about specific TypeSystems. Differential Revision: https://reviews.llvm.org/D66628 llvm-svn: 369735
* [NFC] Remove lldb_utility namespace.Jonas Devlieghere2019-08-212-45/+24
| | | | | | | While generating the Doxygen I noticed this lone namespace that has one class and one function in it. This moves them into lldb_private. llvm-svn: 369485
* [ClangExpressionParser] Add ClangDeclVendorAlex Langford2019-08-202-8/+13
| | | | | | | | | | | | | | | | Summary: This introduces a layer between DeclVendor and the currently implemented DeclVendors (ClangModulesDeclVendor and AppleObjCDeclVendor). This allows the removal of DeclVendor::GetImporterSource which is extremely clang-specific, freeing up the interface to be more general. A good follow up to this would be to remove the remaining instances of clang in DeclVendor, either by moving things to ClangDeclVendor or by using wrappers (e.g. CompilerDecl instead of clang::NamedDecl). Differential Revision: https://reviews.llvm.org/D66451 llvm-svn: 369424
* [lldb] D66174 `RegularExpression` cleanupJan Kratochvil2019-08-201-3/+3
| | | | | | | | | | I find as a good cleanup to drop the Compile method. As I do not find TIMTOWTDI as an advantage and there is already constructor parameter to compile the regex. Differential Revision: https://reviews.llvm.org/D66392 llvm-svn: 369352
* [Symbol] Decouple clang from CompilerTypeAlex Langford2019-08-131-4/+8
| | | | | | | | | | Summary: Ideally CompilerType would have no knowledge of clang or any individual TypeSystem. Decoupling clang is relatively straightforward. Differential Revision: https://reviews.llvm.org/D66102 llvm-svn: 368741
* Remove unused and undocumented data_offset parameter (NFC)Adrian Prantl2019-08-081-1/+1
| | | | | | | | | Value::GetValueAsData() takes an undocumented parameter called data_offset that is always 0. Differential Revision: https://reviews.llvm.org/D65910 llvm-svn: 368330
* [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)Jonas Devlieghere2019-07-246-186/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces explicit calls to log::Printf with the new LLDB_LOGF macro. The macro is similar to LLDB_LOG but supports printf-style format strings, instead of formatv-style format strings. So instead of writing: if (log) log->Printf("%s\n", str); You'd write: LLDB_LOG(log, "%s\n", str); This change was done mechanically with the command below. I replaced the spurious if-checks with vim, since I know how to do multi-line replacements with it. find . -type f -name '*.cpp' -exec \ sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" + Differential revision: https://reviews.llvm.org/D65128 llvm-svn: 366936
* [LanguageRuntime] Move ObjCLanguageRuntime into a pluginAlex Langford2019-07-1513-10/+894
| | | | | | | | | | | | | | 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
* [LanguageRuntime] Move CPPLanguageRuntime into a pluginAlex Langford2019-07-122-1/+2
| | | | | | | | | | | | Summary: This seems better suited to be in a plugin. Reviewers: JDevlieghere, clayborg, jingham, compnerd, labath Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D64599 llvm-svn: 365951
* [Symbol] Add DeclVendor::FindTypesAlex Langford2019-07-022-16/+8
| | | | | | | | | | | | | 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] Decouple ObjCLanguageRuntime from LanguageRuntimeAlex Langford2019-06-212-2/+4
| | | | | | | | | | | | Summary: ObjCLanguageRuntime was being pulled into LanguageRuntime because of Breakpoint Preconditions. If we move BreakpointPrecondition out of Breakpoint, we can extend the LanguageRuntime plugin interface so that LanguageRuntimes can give us a BreakpointPrecondition for exceptions. Differential Revision: https://reviews.llvm.org/D63181 llvm-svn: 364098
* [Process] Remove unused field from HistoryThreadAlex Langford2019-06-191-1/+1
| | | | | | | | | | | | | | Summary: These fields are unused and have been since their inception, from what I can tell. Reviewers: compnerd, JDevlieghere, davide, labath Subscribers: kubamracek, lldb-commits Differential Revision: https://reviews.llvm.org/D63357 llvm-svn: 363881
* Re-land r363103 ("When reading ObjC class table, use new SPI if it is avail")Jason Molenda2019-06-121-4/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | with a call to snprintf() to find the size of the formatted string, malloc memory, then snprintf again to format it into the buffer, instead of calling asprintf. Orig commit msg: When reading ObjC class table, use new SPI if it is avail In the latest OS betas, the objc runtime has a special interface for the debugger, class_getNameRaw(), instead of the existing class_getName(), which will return class names in their raw, unmangled (in the case of swift) form. When lldb can access the unmangled names of classes, it won't need to fetch them out of the inferior process after we run our "get the objc class table" expression. If the new interface is absent (debugging a process on an older target), lldb will fall back to class_getName and reading any class names that it got back in demangled form, at a bit of a performance cost on the first expression. <rdar://problem/50688054> llvm-svn: 363206
* Back out r363103 ("When reading ObjC class table, use new SPI if it is avail")Jason Molenda2019-06-121-50/+4
| | | | | | because it breaks the windows bot - asprintf() is not available. llvm-svn: 363115
* [LanguageRuntime] Simplify CreateExceptionSearchFilter in derived classesAlex Langford2019-06-111-4/+2
| | | | llvm-svn: 363109
* When reading ObjC class table, use new SPI if it is availJason Molenda2019-06-111-4/+50
| | | | | | | | | | | | | | | | | | In the latest OS betas, the objc runtime has a special interface for the debugger, class_getNameRaw(), instead of the existing class_getName(), which will return class names in their raw, unmangled (in the case of swift) form. When lldb can access the unmangled names of classes, it won't need to fetch them out of the inferior process after we run our "get the objc class table" expression. If the new interface is absent (debugging a process on an older target), lldb will fall back to class_getName and reading any class names that it got back in demangled form, at a bit of a performance cost on the first expression. <rdar://problem/50688054> llvm-svn: 363103
* [Target] Remove Process::GetObjCLanguageRuntimeAlex Langford2019-06-103-6/+8
| | | | | | | | | | | 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
* [LanguageRuntime] Introduce LLVM-style castsAlex Langford2019-06-086-22/+30
| | | | | | | | | | | | Summary: Using llvm-style rtti gives us stronger guarantees around casting LanguageRuntimes. As discussed in D62755 Differential Revision: https://reviews.llvm.org/D62934 llvm-svn: 362884
* [Target] Remove Process::GetCPPLanguageRuntimeAlex Langford2019-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: I want to remove this method because I think that Process should be language agnostic, or at least, not have knowledge about specific language runtimes. There is "GetLanguageRuntime()" which should be used instead. If the caller a CPPLanguageRuntime, they should cast it as needed. Ideally, this should only happen in plugins that need C++ specific knowledge. The next step I would like to do is remove "GetObjCLanguageRuntime()" as well. There are a lot more instances of that function being used, so I wanted to upload this one first to get the general reception to this idea. Reviewers: compnerd, davide, JDevlieghere, jingham, clayborg, labath, aprantl Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D62755 llvm-svn: 362544
* Fix integer literals which are cast to boolJonas Devlieghere2019-05-242-5/+5
| | | | | | | | | This change replaces built-in types that are implicitly converted to booleans. Differential revision: https://reviews.llvm.org/D62284 llvm-svn: 361580
* [lldb] NFC modernize codebase with modernize-use-nullptrKonrad Kleine2019-05-237-45/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]] This commit is the result of modernizing the LLDB codebase by using `nullptr` instread of `0` or `NULL`. See https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html for more information. This is the command I ran and I to fix and format the code base: ``` run-clang-tidy.py \ -header-filter='.*' \ -checks='-*,modernize-use-nullptr' \ -fix ~/dev/llvm-project/lldb/.* \ -format \ -style LLVM \ -p ~/llvm-builds/debug-ninja-gcc ``` NOTE: There were also changes to `llvm/utils/unittest` but I did not include them because I felt that maybe this library shall be updated in isolation somehow. NOTE: I know this is a rather large commit but it is a nobrainer in most parts. Reviewers: martong, espindola, shafik, #lldb, JDevlieghere Reviewed By: JDevlieghere Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits Tags: #lldb, #llvm Differential Revision: https://reviews.llvm.org/D61847 llvm-svn: 361484
* typedef enum -> enumFangrui Song2019-05-141-1/+1
| | | | | | | | Reviewed By: labath Differential Revision: https://reviews.llvm.org/D61883 llvm-svn: 360654
* C.128 override, virtual keyword handlingRaphael Isemann2019-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Upstreaming an apple local patch by Frederic Riss.Jason Molenda2019-05-021-1/+32
| | | | | | | | | | | | | | | | | | | lldb has an expression that runs in the inferior process to collect the isa values and hash of the class names for classes in the system's shared cache. In recent OSes, swift classes are in this table and the function the jitted expression calls returns demangled names. We need to compute the hashes based on the mangled names. So for these names, return a hash value of 0 which indicates that lldb should read the class name directly out of the runtime tables and compute the hash itself. When this patch is absent, the lldb+swift testsuite has many failures on a recent macOS system; there isn't a direct non-swift way to test for this being correct. <rdar://problem/47935062> llvm-svn: 359843
* Allow direct comparison of ConstString against StringRefRaphael Isemann2019-04-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When we want to compare a ConstString against a string literal (or any other non-ConstString), we currently have to explicitly turn the other string into a ConstString. This makes sense as comparing ConstStrings against each other is only a fast pointer comparison. However, currently we (rather incorrectly) use in several places in LLDB temporary ConstStrings when we just want to compare a given ConstString against a hardcoded value, for example like this: ``` if (extension != ConstString(".oat") && extension != ConstString(".odex")) ``` Obviously this kind of defeats the point of ConstStrings. In the comparison above we would construct two temporary ConstStrings every time we hit the given code. Constructing a ConstString is relatively expensive: we need to go to the StringPool, take a read and possibly an exclusive write-lock and then look up our temporary string in the string map of the pool. So we do a lot of heavy work for essentially just comparing a <6 characters in two strings. I initially wanted to just fix these issues by turning the temporary ConstString in static variables/ members, but that made the code much less readable. Instead I propose to add a new overload for the ConstString comparison operator that takes a StringRef. This comparison operator directly compares the ConstString content against the given StringRef without turning the StringRef into a ConstString. This means that the example above can look like this now: ``` if (extension != ".oat" && extension != ".odex") ``` It also no longer has to unlock/lock two locks and call multiple functions in other TUs for constructing the temporary ConstString instances. Instead this should end up just being a direct string comparison of the two given strings on most compilers. This patch also directly updates all uses of temporary and short ConstStrings in LLDB to use this new comparison operator. It also adds a some unit tests for the new and old comparison operator. Reviewers: #lldb, JDevlieghere, espindola, amccarth Reviewed By: JDevlieghere, amccarth Subscribers: amccarth, clayborg, JDevlieghere, emaste, arichardson, MaskRay, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D60667 llvm-svn: 359281
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-107-31/+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
* Unify random timeouts throughout LLDB and make them configurable.Adrian Prantl2019-04-052-8/+3
| | | | | | | | | | | | | | | | | Since these timeouts guard against catastrophic error in debugserver, I also increased all of them to the maximum value among them. The motivation for this test was the observation that an asanified LLDB would often exhibit seemingly random test failures that could be traced back to debugserver packets getting out of sync. With this path applied I can no longer reproduce the one particular failure mode that I was investigating. rdar://problem/49441261 Differential Revision: https://reviews.llvm.org/D60340 llvm-svn: 357829
* Promote more debug-only assertions to regular assertions.Adrian Prantl2019-03-071-2/+0
| | | | llvm-svn: 355568
OpenPOWER on IntegriCloud