mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Reinstate ”Use the new mangling for reflection."
It also uses the new mangling for type names in meta-data (except for top-level non-generic classes).
lldb has now support for new mangled metadata type names.
This reinstates commit 21ba292943.
This commit is contained in:
@@ -15,10 +15,8 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Basic/Demangle.h"
|
||||
#ifndef NO_NEW_DEMANGLING
|
||||
#include "swift/Basic/Demangler.h"
|
||||
#include "swift/Basic/ManglingMacros.h"
|
||||
#endif
|
||||
#include "swift/Strings.h"
|
||||
#include "swift/Basic/LLVM.h"
|
||||
#include "swift/Basic/Punycode.h"
|
||||
@@ -325,12 +323,10 @@ public:
|
||||
///
|
||||
/// \return true if the mangling succeeded
|
||||
NodePointer demangleTopLevel() {
|
||||
#ifndef NO_NEW_DEMANGLING
|
||||
if (Mangled.str().startswith(MANGLING_PREFIX_STR)) {
|
||||
NewMangling::Demangler D(Mangled.str());
|
||||
return D.demangleTopLevel();
|
||||
}
|
||||
#endif
|
||||
if (!Mangled.nextIf("_T"))
|
||||
return nullptr;
|
||||
|
||||
@@ -2342,23 +2338,18 @@ swift::Demangle::isSwiftSymbol(const char *mangledName) {
|
||||
if (mangledName[0] == '_' && mangledName[1] == 'T')
|
||||
return true;
|
||||
|
||||
#ifndef NO_NEW_DEMANGLING
|
||||
// The new mangling.
|
||||
for (unsigned i = 0; i < sizeof(MANGLING_PREFIX_STR) - 1; i++) {
|
||||
if (mangledName[i] != MANGLING_PREFIX_STR[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#else // !NO_NEW_DEMANGLING
|
||||
return false;
|
||||
#endif // !NO_NEW_DEMANGLING
|
||||
}
|
||||
|
||||
bool
|
||||
swift::Demangle::isThunkSymbol(const char *mangledName,
|
||||
size_t mangledNameLength) {
|
||||
StringRef Name(mangledName, mangledNameLength);
|
||||
#ifndef NO_NEW_DEMANGLING
|
||||
if (Name.startswith(MANGLING_PREFIX_STR)) {
|
||||
// First do a quick check
|
||||
if (Name.endswith("TA") || // partial application forwarder
|
||||
@@ -2384,7 +2375,6 @@ swift::Demangle::isThunkSymbol(const char *mangledName,
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // !NO_NEW_DEMANGLING
|
||||
|
||||
if (Name.startswith("_T")) {
|
||||
// Old mangling.
|
||||
@@ -2410,8 +2400,8 @@ NodePointer
|
||||
swift::Demangle::demangleTypeAsNode(const char *MangledName,
|
||||
size_t MangledNameLength,
|
||||
const DemangleOptions &Options) {
|
||||
OldDemangler demangler(StringRef(MangledName, MangledNameLength));
|
||||
return demangler.demangleTypeName();
|
||||
NewMangling::Demangler D(StringRef(MangledName, MangledNameLength));
|
||||
return D.demangleType();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
Reference in New Issue
Block a user