Skip to content

Commit dcccc26

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents d9ed1ae + 22c34dd commit dcccc26

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

lib/Demangling/RemanglerBase.h

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "swift/Demangling/Demangler.h"
2121
#include "swift/Demangling/NamespaceMacros.h"
22+
#include "llvm/ADT/PointerIntPair.h"
2223
#include <unordered_map>
2324

2425
using namespace swift::Demangle;
@@ -37,14 +38,19 @@ SWIFT_BEGIN_INLINE_NAMESPACE
3738

3839
// An entry in the remangler's substitution map.
3940
class SubstitutionEntry {
40-
Node *TheNode = nullptr;
41+
llvm::PointerIntPair<Node *, 1, bool> NodeAndTreatAsIdentifier;
4142
size_t StoredHash = 0;
42-
bool treatAsIdentifier = false;
43+
44+
Node *getNode() const { return NodeAndTreatAsIdentifier.getPointer(); }
45+
46+
bool getTreatAsIdentifier() const {
47+
return NodeAndTreatAsIdentifier.getInt();
48+
}
4349

4450
public:
4551
void setNode(Node *node, bool treatAsIdentifier, size_t hash) {
46-
this->treatAsIdentifier = treatAsIdentifier;
47-
TheNode = node;
52+
NodeAndTreatAsIdentifier.setPointer(node);
53+
NodeAndTreatAsIdentifier.setInt(treatAsIdentifier);
4854
StoredHash = hash;
4955
}
5056

@@ -54,10 +60,10 @@ class SubstitutionEntry {
5460
}
5561
};
5662

57-
bool isEmpty() const { return !TheNode; }
63+
bool isEmpty() const { return !getNode(); }
5864

5965
bool matches(Node *node, bool treatAsIdentifier) const {
60-
return node == TheNode && treatAsIdentifier == this->treatAsIdentifier;
66+
return node == getNode() && treatAsIdentifier == getTreatAsIdentifier();
6167
}
6268

6369
size_t hash() const { return StoredHash; }
@@ -67,12 +73,12 @@ class SubstitutionEntry {
6773
const SubstitutionEntry &rhs) {
6874
if (lhs.StoredHash != rhs.StoredHash)
6975
return false;
70-
if (lhs.treatAsIdentifier != rhs.treatAsIdentifier)
76+
if (lhs.getTreatAsIdentifier() != rhs.getTreatAsIdentifier())
7177
return false;
72-
if (lhs.treatAsIdentifier) {
73-
return identifierEquals(lhs.TheNode, rhs.TheNode);
78+
if (lhs.getTreatAsIdentifier()) {
79+
return identifierEquals(lhs.getNode(), rhs.getNode());
7480
}
75-
return lhs.deepEquals(lhs.TheNode, rhs.TheNode);
81+
return lhs.deepEquals(lhs.getNode(), rhs.getNode());
7682
}
7783

7884
static bool identifierEquals(Node *lhs, Node *rhs);

stdlib/public/runtime/Errors.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,11 @@ void swift::swift_abortRetainUnowned(const void *object) {
506506
if (object) {
507507
swift::fatalError(FatalErrorFlags::ReportBacktrace,
508508
"Fatal error: Attempted to read an unowned reference but "
509-
"object %p was already deallocated\n", object);
509+
"object %p was already destroyed\n", object);
510510
} else {
511511
swift::fatalError(FatalErrorFlags::ReportBacktrace,
512512
"Fatal error: Attempted to read an unowned reference but "
513-
"the object was already deallocated\n");
513+
"the object was already destroyed\n");
514514
}
515515
}
516516

0 commit comments

Comments
 (0)