Importing rustc-1.38.0
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/CF.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/CF.cpp
index e3dab5a..5bca260 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/CF.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/CF.cpp
@@ -1,10 +1,9 @@
//===-- CF.cpp ----------------------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -15,7 +14,6 @@
#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Language.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
@@ -23,6 +21,8 @@
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
+#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
+
using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::formatters;
@@ -51,9 +51,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -115,9 +113,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -140,10 +136,8 @@
bool is_type_ok = false; // check to see if this is a CFBag we know about
if (descriptor->IsCFType()) {
ConstString type_name(valobj.GetTypeName());
- if (type_name == ConstString("__CFMutableBitVector") ||
- type_name == ConstString("__CFBitVector") ||
- type_name == ConstString("CFMutableBitVectorRef") ||
- type_name == ConstString("CFBitVectorRef")) {
+ if (type_name == "__CFMutableBitVector" || type_name == "__CFBitVector" ||
+ type_name == "CFMutableBitVectorRef" || type_name == "CFBitVectorRef") {
if (valobj.IsPointerType())
is_type_ok = true;
}
@@ -239,9 +233,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/CF.h b/src/llvm-project/lldb/source/Plugins/Language/ObjC/CF.h
index 6945f9e..2abb56d 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/CF.h
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/CF.h
@@ -1,9 +1,8 @@
//===-- CF.h ---------------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
index 4808537..ddf3953 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -1,9 +1,8 @@
//===-- Cocoa.cpp -----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -18,7 +17,6 @@
#include "lldb/Host/Time.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Language.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/ProcessStructReader.h"
#include "lldb/Target/Target.h"
@@ -28,6 +26,7 @@
#include "lldb/Utility/Stream.h"
#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/bit.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h"
@@ -43,9 +42,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -93,9 +90,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -140,9 +135,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -187,9 +180,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -235,9 +226,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -426,9 +415,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -484,10 +471,9 @@
return true;
} else {
Status error;
-
- AppleObjCRuntime *runtime =
- llvm::dyn_cast_or_null<AppleObjCRuntime>(
- process_sp->GetObjCLanguageRuntime());
+
+ AppleObjCRuntime *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
+ ObjCLanguageRuntime::Get(*process_sp));
const bool new_format =
(runtime && runtime->GetFoundationVersion() >= 1400);
@@ -679,9 +665,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -750,24 +734,18 @@
/// distantFuture, except within about 1e-25 second of the reference date.
const int TAGGED_DATE_EXPONENT_BIAS = 0x3ef;
-typedef union {
- struct {
- uint64_t fraction:52; // unsigned
- uint64_t exponent:11; // signed
- uint64_t sign:1;
- };
- uint64_t i;
- double d;
-} DoubleBits;
-typedef union {
- struct {
- uint64_t fraction:52; // unsigned
- uint64_t exponent:7; // signed
- uint64_t sign:1;
- uint64_t unused:4; // placeholder for pointer tag bits
- };
- uint64_t i;
-} TaggedDoubleBits;
+struct DoubleBits {
+ uint64_t fraction : 52; // unsigned
+ uint64_t exponent : 11; // signed
+ uint64_t sign : 1;
+};
+
+struct TaggedDoubleBits {
+ uint64_t fraction : 52; // unsigned
+ uint64_t exponent : 7; // signed
+ uint64_t sign : 1;
+ uint64_t unused : 4; // placeholder for pointer tag bits
+};
static uint64_t decodeExponent(uint64_t exp) {
// Tagged exponent field is 7-bit signed. Sign-extend the value to 64 bits
@@ -775,24 +753,24 @@
return llvm::SignExtend64<7>(exp) + TAGGED_DATE_EXPONENT_BIAS;
}
-static uint64_t decodeTaggedTimeInterval(uint64_t encodedTimeInterval) {
+static double decodeTaggedTimeInterval(uint64_t encodedTimeInterval) {
if (encodedTimeInterval == 0)
return 0.0;
if (encodedTimeInterval == std::numeric_limits<uint64_t>::max())
return (uint64_t)-0.0;
- TaggedDoubleBits encodedBits = {};
- encodedBits.i = encodedTimeInterval;
- DoubleBits decodedBits;
+ TaggedDoubleBits encodedBits =
+ llvm::bit_cast<TaggedDoubleBits>(encodedTimeInterval);
+ assert(encodedBits.unused == 0);
// Sign and fraction are represented exactly.
// Exponent is encoded.
- assert(encodedBits.unused == 0);
+ DoubleBits decodedBits;
decodedBits.sign = encodedBits.sign;
decodedBits.fraction = encodedBits.fraction;
decodedBits.exponent = decodeExponent(encodedBits.exponent);
- return decodedBits.d;
+ return llvm::bit_cast<double>(decodedBits);
}
bool lldb_private::formatters::NSDateSummaryProvider(
@@ -801,9 +779,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -869,7 +845,8 @@
// Accomodate for the __NSTaggedDate format introduced in Foundation 1600.
if (class_name == g___NSTaggedDate) {
- auto *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(process_sp->GetObjCLanguageRuntime());
+ auto *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
+ ObjCLanguageRuntime::Get(*process_sp));
if (runtime && runtime->GetFoundationVersion() >= 1600)
date_value = decodeTaggedTimeInterval(value_bits << 4);
}
@@ -897,9 +874,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -940,7 +915,7 @@
bool MightHaveChildren() override { return false; }
- size_t GetIndexOfChildWithName(const ConstString &name) override {
+ size_t GetIndexOfChildWithName(ConstString name) override {
return UINT32_MAX;
}
};
@@ -958,9 +933,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -1059,8 +1032,8 @@
if (!process_sp)
return false;
- if (AppleObjCRuntime *objc_runtime =
- (AppleObjCRuntime *)process_sp->GetObjCLanguageRuntime()) {
+ if (AppleObjCRuntime *objc_runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
+ ObjCLanguageRuntime::Get(*process_sp))) {
lldb::addr_t cf_true = LLDB_INVALID_ADDRESS,
cf_false = LLDB_INVALID_ADDRESS;
objc_runtime->GetValuesForGlobalCFBooleans(cf_true, cf_false);
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/Cocoa.h b/src/llvm-project/lldb/source/Plugins/Language/ObjC/Cocoa.h
index 0f2ca54..388e6f0 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/Cocoa.h
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/Cocoa.h
@@ -1,10 +1,9 @@
//===-- Cocoa.h ---------------------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -14,9 +13,10 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Utility/Stream.h"
+#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
+
namespace lldb_private {
namespace formatters {
bool NSIndexSetSummaryProvider(ValueObject &valobj, Stream &stream,
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp
index cbc38c9..d19290e 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp
@@ -1,10 +1,9 @@
//===-- CoreMedia.cpp --------------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/CoreMedia.h b/src/llvm-project/lldb/source/Plugins/Language/ObjC/CoreMedia.h
index 98561efb..79abb67 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/CoreMedia.h
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/CoreMedia.h
@@ -1,10 +1,9 @@
//===-- CoreMedia.h -----------------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp
index 6c110da..404dabf 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp
@@ -1,9 +1,8 @@
//===-- NSArray.cpp ---------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -12,13 +11,13 @@
#include "Cocoa.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h"
+
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Expression/FunctionCaller.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Language.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Endian.h"
@@ -58,7 +57,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
protected:
virtual lldb::addr_t GetDataAddress() = 0;
@@ -172,13 +171,8 @@
PtrType _data;
uint32_t _offset;
uint32_t _size;
- union {
- PtrType _mutations;
- struct {
- uint32_t _muts;
- uint32_t _used;
- };
- };
+ uint32_t _muts;
+ uint32_t _used;
};
using NSArrayMSyntheticFrontEnd =
@@ -248,7 +242,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
private:
ExecutionContextRef m_exe_ctx_ref;
@@ -320,7 +314,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
};
class NSArray1SyntheticFrontEnd : public SyntheticChildrenFrontEnd {
@@ -337,7 +331,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
};
} // namespace formatters
} // namespace lldb_private
@@ -350,9 +344,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -550,7 +542,7 @@
size_t
lldb_private::formatters::NSArrayMSyntheticFrontEndBase::GetIndexOfChildWithName(
- const ConstString &name) {
+ ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
@@ -639,7 +631,7 @@
template <typename D32, typename D64, bool Inline>
size_t
lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
- GetIndexOfChildWithName(const ConstString &name) {
+ GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
@@ -729,7 +721,7 @@
size_t
lldb_private::formatters::NSArray0SyntheticFrontEnd::GetIndexOfChildWithName(
- const ConstString &name) {
+ ConstString name) {
return UINT32_MAX;
}
@@ -758,7 +750,7 @@
size_t
lldb_private::formatters::NSArray1SyntheticFrontEnd::GetIndexOfChildWithName(
- const ConstString &name) {
+ ConstString name) {
static const ConstString g_zero("[0]");
if (name == g_zero)
@@ -805,7 +797,7 @@
if (!process_sp)
return nullptr;
AppleObjCRuntime *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
- process_sp->GetObjCLanguageRuntime());
+ ObjCLanguageRuntime::Get(*process_sp));
if (!runtime)
return nullptr;
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
index 9a7fc2b..10f66c4 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
@@ -1,9 +1,8 @@
//===-- NSDictionary.cpp ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -20,7 +19,6 @@
#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Language.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
@@ -112,7 +110,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
private:
struct DataDescriptor_32 {
@@ -155,7 +153,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
private:
ValueObjectSP m_pair;
@@ -176,7 +174,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
private:
struct DictionaryItemDescriptor {
@@ -209,7 +207,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
private:
struct DataDescriptor_32 {
@@ -282,18 +280,11 @@
struct DataDescriptor_32 {
uint32_t _buffer;
- union {
- struct {
- uint32_t _mutations;
- };
- struct {
- uint32_t _muts;
- uint32_t _used:25;
- uint32_t _kvo:1;
- uint32_t _szidx:6;
- };
- };
-
+ uint32_t _muts;
+ uint32_t _used : 25;
+ uint32_t _kvo : 1;
+ uint32_t _szidx : 6;
+
uint64_t GetSize() {
return (_szidx) >= NSDictionaryNumSizeBuckets ?
0 : NSDictionaryCapacities[_szidx];
@@ -302,18 +293,11 @@
struct DataDescriptor_64 {
uint64_t _buffer;
- union {
- struct {
- uint64_t _mutations;
- };
- struct {
- uint32_t _muts;
- uint32_t _used:25;
- uint32_t _kvo:1;
- uint32_t _szidx:6;
- };
- };
-
+ uint32_t _muts;
+ uint32_t _used : 25;
+ uint32_t _kvo : 1;
+ uint32_t _szidx : 6;
+
uint64_t GetSize() {
return (_szidx) >= NSDictionaryNumSizeBuckets ?
0 : NSDictionaryCapacities[_szidx];
@@ -362,9 +346,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -454,8 +436,8 @@
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return nullptr;
- AppleObjCRuntime *runtime =
- llvm::dyn_cast_or_null<AppleObjCRuntime>(process_sp->GetObjCLanguageRuntime());
+ AppleObjCRuntime *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
+ ObjCLanguageRuntime::Get(*process_sp));
if (!runtime)
return nullptr;
@@ -527,7 +509,7 @@
}
size_t lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
- GetIndexOfChildWithName(const ConstString &name) {
+ GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
@@ -663,7 +645,7 @@
: SyntheticChildrenFrontEnd(*valobj_sp.get()), m_pair(nullptr) {}
size_t lldb_private::formatters::NSDictionary1SyntheticFrontEnd::
- GetIndexOfChildWithName(const ConstString &name) {
+ GetIndexOfChildWithName(ConstString name) {
static const ConstString g_zero("[0]");
return name == g_zero ? 0 : UINT32_MAX;
}
@@ -751,7 +733,7 @@
template <typename D32, typename D64>
size_t
-lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>:: GetIndexOfChildWithName(const ConstString &name) {
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>:: GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
@@ -920,7 +902,7 @@
size_t
lldb_private::formatters::Foundation1100::
- NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName(const ConstString &name) {
+ NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.h b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.h
index 6ec9a8e..ecb3fcc 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.h
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.h
@@ -1,10 +1,9 @@
//===-- NSDictionary.h ---------------------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -52,8 +51,8 @@
class Prefix : public Matcher {
public:
Prefix(ConstString p);
- virtual ~Prefix() = default;
- virtual bool Match(ConstString class_name) override;
+ ~Prefix() override = default;
+ bool Match(ConstString class_name) override;
private:
ConstString m_prefix;
@@ -61,8 +60,8 @@
class Full : public Matcher {
public:
Full(ConstString n);
- virtual ~Full() = default;
- virtual bool Match(ConstString class_name) override;
+ ~Full() override = default;
+ bool Match(ConstString class_name) override;
private:
ConstString m_name;
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSError.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSError.cpp
index 975bda5..97df3be 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSError.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSError.cpp
@@ -1,9 +1,8 @@
//===-- NSError.cpp ---------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -15,7 +14,6 @@
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/ProcessStructReader.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
@@ -24,6 +22,7 @@
#include "lldb/Utility/Stream.h"
#include "Plugins/Language/ObjC/NSString.h"
+#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
using namespace lldb;
using namespace lldb_private;
@@ -164,7 +163,7 @@
bool MightHaveChildren() override { return true; }
- size_t GetIndexOfChildWithName(const ConstString &name) override {
+ size_t GetIndexOfChildWithName(ConstString name) override {
static ConstString g___userInfo("_userInfo");
if (name == g___userInfo)
return 0;
@@ -188,9 +187,7 @@
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return nullptr;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return nullptr;
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSException.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSException.cpp
index 2404ef9..931794a 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSException.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSException.cpp
@@ -1,9 +1,8 @@
//===-- NSException.cpp -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -15,7 +14,6 @@
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/ProcessStructReader.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
@@ -24,6 +22,7 @@
#include "lldb/Utility/Stream.h"
#include "Plugins/Language/ObjC/NSString.h"
+#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
using namespace lldb;
using namespace lldb_private;
@@ -150,7 +149,7 @@
bool MightHaveChildren() override { return true; }
- size_t GetIndexOfChildWithName(const ConstString &name) override {
+ size_t GetIndexOfChildWithName(ConstString name) override {
// NSException has 4 members:
// NSString *name;
// NSString *reason;
@@ -180,9 +179,7 @@
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return nullptr;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return nullptr;
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
index 41df9ab..9ee6021 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
@@ -1,9 +1,8 @@
//===-- NSIndexPath.cpp -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -14,10 +13,10 @@
#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
#include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::formatters;
@@ -69,9 +68,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -128,7 +125,7 @@
bool MightHaveChildren() override { return m_impl.m_mode != Mode::Invalid; }
- size_t GetIndexOfChildWithName(const ConstString &name) override {
+ size_t GetIndexOfChildWithName(ConstString name) override {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp
index 7e03d75..ebaa990 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp
@@ -1,9 +1,8 @@
//===-- NSSet.cpp -----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -15,7 +14,6 @@
#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Language.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Endian.h"
@@ -55,7 +53,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
private:
struct DataDescriptor_32 {
@@ -96,7 +94,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
private:
@@ -155,28 +153,18 @@
uint32_t _cow;
// __table storage
uint32_t _objs_addr;
- union {
- uint32_t _mutations;
- struct {
- uint32_t _muts;
- uint32_t _used : 26;
- uint32_t _szidx : 6;
- };
- };
+ uint32_t _muts;
+ uint32_t _used : 26;
+ uint32_t _szidx : 6;
};
struct DataDescriptor_64 {
uint64_t _cow;
// __Table storage
uint64_t _objs_addr;
- union {
- uint64_t _mutations;
- struct {
- uint32_t _muts;
- uint32_t _used : 26;
- uint32_t _szidx : 6;
- };
- };
+ uint32_t _muts;
+ uint32_t _used : 26;
+ uint32_t _szidx : 6;
};
using NSSetMSyntheticFrontEnd =
@@ -222,7 +210,7 @@
bool MightHaveChildren() override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
};
} // namespace formatters
} // namespace lldb_private
@@ -236,9 +224,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
@@ -315,9 +301,7 @@
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return nullptr;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return nullptr;
@@ -385,7 +369,7 @@
size_t
lldb_private::formatters::NSSetISyntheticFrontEnd::GetIndexOfChildWithName(
- const ConstString &name) {
+ ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
@@ -540,7 +524,7 @@
size_t
lldb_private::formatters::
GenericNSSetMSyntheticFrontEnd<D32, D64>::GetIndexOfChildWithName(
- const ConstString &name) {
+ ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.h b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.h
index 00451be..f11b6d4 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.h
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.h
@@ -1,10 +1,9 @@
//===-- NSSet.h ---------------------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSString.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSString.cpp
index f882b2a..4800c95 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSString.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSString.cpp
@@ -1,10 +1,9 @@
//===-- NSString.cpp ----------------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -60,9 +59,7 @@
if (!process_sp)
return false;
- ObjCLanguageRuntime *runtime =
- (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
- lldb::eLanguageTypeObjC);
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (!runtime)
return false;
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSString.h b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSString.h
index 3a923c2..699d8eb 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSString.h
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/NSString.h
@@ -1,10 +1,9 @@
//===-- NSString.h ---------------------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -13,9 +12,10 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/DataFormatters/TypeSummary.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Utility/Stream.h"
+#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
+
namespace lldb_private {
namespace formatters {
bool NSStringSummaryProvider(ValueObject &valobj, Stream &stream,
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/src/llvm-project/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
index 0598d69..f9ab186 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
@@ -1,9 +1,8 @@
//===-- ObjCLanguage.cpp ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -17,13 +16,14 @@
#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompilerType.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/StreamString.h"
#include "llvm/Support/Threading.h"
+#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
+
#include "CF.h"
#include "Cocoa.h"
#include "CoreMedia.h"
@@ -49,9 +49,7 @@
return g_name;
}
-//------------------------------------------------------------------
// PluginInterface protocol
-//------------------------------------------------------------------
lldb_private::ConstString ObjCLanguage::GetPluginName() {
return GetPluginNameStatic();
@@ -59,9 +57,7 @@
uint32_t ObjCLanguage::GetPluginVersion() { return 1; }
-//------------------------------------------------------------------
// Static Functions
-//------------------------------------------------------------------
Language *ObjCLanguage::CreateInstance(lldb::LanguageType language) {
switch (language) {
@@ -120,7 +116,7 @@
return SetName(llvm::StringRef(name), strict);
}
-const ConstString &ObjCLanguage::MethodName::GetClassName() {
+ConstString ObjCLanguage::MethodName::GetClassName() {
if (!m_class) {
if (IsValid(false)) {
const char *full = m_full.GetCString();
@@ -146,7 +142,7 @@
return m_class;
}
-const ConstString &ObjCLanguage::MethodName::GetClassNameWithCategory() {
+ConstString ObjCLanguage::MethodName::GetClassNameWithCategory() {
if (!m_class_category) {
if (IsValid(false)) {
const char *full = m_full.GetCString();
@@ -169,7 +165,7 @@
return m_class_category;
}
-const ConstString &ObjCLanguage::MethodName::GetSelector() {
+ConstString ObjCLanguage::MethodName::GetSelector() {
if (!m_selector) {
if (IsValid(false)) {
const char *full = m_full.GetCString();
@@ -184,7 +180,7 @@
return m_selector;
}
-const ConstString &ObjCLanguage::MethodName::GetCategory() {
+ConstString ObjCLanguage::MethodName::GetCategory() {
if (!m_category_is_valid && !m_category) {
if (IsValid(false)) {
m_category_is_valid = true;
@@ -225,43 +221,46 @@
return ConstString();
}
-size_t ObjCLanguage::MethodName::GetFullNames(std::vector<ConstString> &names,
- bool append) {
- if (!append)
- names.clear();
- if (IsValid(false)) {
+std::vector<ConstString>
+ObjCLanguage::GetMethodNameVariants(ConstString method_name) const {
+ std::vector<ConstString> variant_names;
+ ObjCLanguage::MethodName objc_method(method_name.GetCString(), false);
+ if (!objc_method.IsValid(false)) {
+ return variant_names;
+ }
+
+ const bool is_class_method =
+ objc_method.GetType() == MethodName::eTypeClassMethod;
+ const bool is_instance_method =
+ objc_method.GetType() == MethodName::eTypeInstanceMethod;
+ ConstString name_sans_category =
+ objc_method.GetFullNameWithoutCategory(/*empty_if_no_category*/ true);
+
+ if (is_class_method || is_instance_method) {
+ if (name_sans_category)
+ variant_names.emplace_back(name_sans_category);
+ } else {
StreamString strm;
- const bool is_class_method = m_type == eTypeClassMethod;
- const bool is_instance_method = m_type == eTypeInstanceMethod;
- const ConstString &category = GetCategory();
- if (is_class_method || is_instance_method) {
- names.push_back(m_full);
- if (category) {
- strm.Printf("%c[%s %s]", is_class_method ? '+' : '-',
- GetClassName().GetCString(), GetSelector().GetCString());
- names.emplace_back(strm.GetString());
- }
- } else {
- const ConstString &class_name = GetClassName();
- const ConstString &selector = GetSelector();
- strm.Printf("+[%s %s]", class_name.GetCString(), selector.GetCString());
- names.emplace_back(strm.GetString());
+
+ strm.Printf("+%s", objc_method.GetFullName().GetCString());
+ variant_names.emplace_back(strm.GetString());
+ strm.Clear();
+
+ strm.Printf("-%s", objc_method.GetFullName().GetCString());
+ variant_names.emplace_back(strm.GetString());
+ strm.Clear();
+
+ if (name_sans_category) {
+ strm.Printf("+%s", name_sans_category.GetCString());
+ variant_names.emplace_back(strm.GetString());
strm.Clear();
- strm.Printf("-[%s %s]", class_name.GetCString(), selector.GetCString());
- names.emplace_back(strm.GetString());
- strm.Clear();
- if (category) {
- strm.Printf("+[%s(%s) %s]", class_name.GetCString(),
- category.GetCString(), selector.GetCString());
- names.emplace_back(strm.GetString());
- strm.Clear();
- strm.Printf("-[%s(%s) %s]", class_name.GetCString(),
- category.GetCString(), selector.GetCString());
- names.emplace_back(strm.GetString());
- }
+
+ strm.Printf("-%s", name_sans_category.GetCString());
+ variant_names.emplace_back(strm.GetString());
}
}
- return names.size();
+
+ return variant_names;
}
static void LoadObjCFormatters(TypeCategoryImplSP objc_category_sp) {
@@ -286,7 +285,6 @@
objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL *"),
ObjC_BOOL_summary);
-#ifndef LLDB_DISABLE_PYTHON
// we need to skip pointers here since we are special casing a SEL* when
// retrieving its value
objc_flags.SetSkipPointers(true);
@@ -318,7 +316,6 @@
lldb_private::formatters::ObjCClassSyntheticFrontEndCreator,
"Class synthetic children", ConstString("Class"),
class_synth_flags);
-#endif // LLDB_DISABLE_PYTHON
objc_flags.SetSkipPointers(false);
objc_flags.SetCascades(true);
@@ -384,7 +381,6 @@
appkit_flags.SetDontShowChildren(false);
-#ifndef LLDB_DISABLE_PYTHON
AddCXXSummary(
objc_category_sp, lldb_private::formatters::NSArraySummaryProvider,
"NSArray summary provider", ConstString("NSArray"), appkit_flags);
@@ -841,7 +837,6 @@
lldb_private::formatters::CFBitVectorSummaryProvider,
"CFBitVector summary provider",
ConstString("__CFMutableBitVector"), appkit_flags);
-#endif // LLDB_DISABLE_PYTHON
}
static void LoadCoreMediaFormatters(TypeCategoryImplSP objc_category_sp) {
@@ -857,11 +852,9 @@
.SetSkipPointers(false)
.SetSkipReferences(false);
-#ifndef LLDB_DISABLE_PYTHON
AddCXXSummary(objc_category_sp,
lldb_private::formatters::CMTimeSummaryProvider,
"CMTime summary provider", ConstString("CMTime"), cm_flags);
-#endif // LLDB_DISABLE_PYTHON
}
lldb::TypeCategoryImplSP ObjCLanguage::GetFormatters() {
@@ -898,7 +891,7 @@
lldb::ProcessSP process_sp = valobj.GetProcessSP();
if (!process_sp)
break;
- ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+ ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
if (runtime == nullptr)
break;
ObjCLanguageRuntime::ClassDescriptorSP objc_class_sp(
@@ -940,26 +933,16 @@
ResultSet &results) override {
bool result = false;
- Process *process = exe_scope->CalculateProcess().get();
- if (process) {
- const bool create_on_demand = false;
- auto objc_runtime = process->GetObjCLanguageRuntime(create_on_demand);
- if (objc_runtime) {
- auto decl_vendor = objc_runtime->GetDeclVendor();
- if (decl_vendor) {
- std::vector<clang::NamedDecl *> decls;
+ if (auto *process = exe_scope->CalculateProcess().get()) {
+ if (auto *objc_runtime = ObjCLanguageRuntime::Get(*process)) {
+ if (auto *decl_vendor = objc_runtime->GetDeclVendor()) {
ConstString name(key);
- decl_vendor->FindDecls(name, true, UINT32_MAX, decls);
- for (auto decl : decls) {
- if (decl) {
- if (CompilerType candidate =
- ClangASTContext::GetTypeForDecl(decl)) {
- result = true;
- std::unique_ptr<Language::TypeScavenger::Result> result(
- new ObjCScavengerResult(candidate));
- results.insert(std::move(result));
- }
- }
+ for (const CompilerType &type :
+ decl_vendor->FindTypes(name, /*max_matches*/ UINT32_MAX)) {
+ result = true;
+ std::unique_ptr<Language::TypeScavenger::Result> result(
+ new ObjCScavengerResult(type));
+ results.insert(std::move(result));
}
}
}
@@ -977,21 +960,16 @@
ResultSet &results) override {
bool result = false;
- Target *target = exe_scope->CalculateTarget().get();
- if (target) {
- if (auto clang_modules_decl_vendor =
+ if (auto *target = exe_scope->CalculateTarget().get()) {
+ if (auto *clang_modules_decl_vendor =
target->GetClangModulesDeclVendor()) {
- std::vector<clang::NamedDecl *> decls;
ConstString key_cs(key);
-
- if (clang_modules_decl_vendor->FindDecls(key_cs, false, UINT32_MAX,
- decls) > 0 &&
- !decls.empty()) {
- CompilerType module_type =
- ClangASTContext::GetTypeForDecl(decls.front());
+ auto types = clang_modules_decl_vendor->FindTypes(
+ key_cs, /*max_matches*/ UINT32_MAX);
+ if (!types.empty()) {
result = true;
std::unique_ptr<Language::TypeScavenger::Result> result(
- new ObjCScavengerResult(module_type));
+ new ObjCScavengerResult(types.front()));
results.insert(std::move(result));
}
}
@@ -1005,7 +983,7 @@
class ObjCDebugInfoScavenger : public Language::ImageListTypeScavenger {
public:
- virtual CompilerType AdjustForInclusion(CompilerType &candidate) override {
+ CompilerType AdjustForInclusion(CompilerType &candidate) override {
LanguageType lang_type(candidate.GetMinimumLanguage());
if (!Language::LanguageIsObjC(lang_type))
return CompilerType();
diff --git a/src/llvm-project/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h b/src/llvm-project/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
index 114f932..3e2cc09 100644
--- a/src/llvm-project/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
+++ b/src/llvm-project/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
@@ -1,9 +1,8 @@
//===-- ObjCLanguage.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -59,32 +58,20 @@
Type GetType() const { return m_type; }
- const ConstString &GetFullName() const { return m_full; }
+ ConstString GetFullName() const { return m_full; }
ConstString GetFullNameWithoutCategory(bool empty_if_no_category);
bool SetName(const char *name, bool strict);
bool SetName(llvm::StringRef name, bool strict);
- const ConstString &GetClassName();
+ ConstString GetClassName();
- const ConstString &GetClassNameWithCategory();
+ ConstString GetClassNameWithCategory();
- const ConstString &GetCategory();
+ ConstString GetCategory();
- const ConstString &GetSelector();
-
- // Get all possible names for a method. Examples:
- // If name is "+[NSString(my_additions) myStringWithCString:]"
- // names[0] => "+[NSString(my_additions) myStringWithCString:]"
- // names[1] => "+[NSString myStringWithCString:]"
- // If name is specified without the leading '+' or '-' like
- // "[NSString(my_additions) myStringWithCString:]"
- // names[0] => "+[NSString(my_additions) myStringWithCString:]"
- // names[1] => "-[NSString(my_additions) myStringWithCString:]"
- // names[2] => "+[NSString myStringWithCString:]"
- // names[3] => "-[NSString myStringWithCString:]"
- size_t GetFullNames(std::vector<ConstString> &names, bool append);
+ ConstString GetSelector();
protected:
ConstString
@@ -106,6 +93,18 @@
return lldb::eLanguageTypeObjC;
}
+ // Get all possible names for a method. Examples:
+ // If method_name is "+[NSString(my_additions) myStringWithCString:]"
+ // variant_names[0] => "+[NSString myStringWithCString:]"
+ // If name is specified without the leading '+' or '-' like
+ // "[NSString(my_additions) myStringWithCString:]"
+ // variant_names[0] => "+[NSString(my_additions) myStringWithCString:]"
+ // variant_names[1] => "-[NSString(my_additions) myStringWithCString:]"
+ // variant_names[2] => "+[NSString myStringWithCString:]"
+ // variant_names[3] => "-[NSString myStringWithCString:]"
+ std::vector<ConstString>
+ GetMethodNameVariants(ConstString method_name) const override;
+
lldb::TypeCategoryImplSP GetFormatters() override;
std::vector<ConstString>
@@ -124,9 +123,7 @@
const Highlighter *GetHighlighter() const override { return &m_highlighter; }
- //------------------------------------------------------------------
// Static Functions
- //------------------------------------------------------------------
static void Initialize();
static void Terminate();
@@ -155,9 +152,7 @@
return false;
}
- //------------------------------------------------------------------
// PluginInterface protocol
- //------------------------------------------------------------------
ConstString GetPluginName() override;
uint32_t GetPluginVersion() override;