Debugger: Remove name demangler

Never been used, completely outdated, fails autotest.

Change-Id: I2c1808b4a66e9abdb839670eeae3e5226c7246ba
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-07-06 15:44:37 +02:00
parent 014a57c764
commit fed5a85110
17 changed files with 0 additions and 5050 deletions

View File

@@ -58,10 +58,6 @@ add_qtc_plugin(Debugger
logwindow.cpp logwindow.h
memoryagent.cpp memoryagent.h
moduleshandler.cpp moduleshandler.h
namedemangler/demanglerexceptions.h
namedemangler/globalparsestate.cpp namedemangler/globalparsestate.h
namedemangler/namedemangler.cpp namedemangler/namedemangler.h
namedemangler/parsetreenodes.cpp namedemangler/parsetreenodes.h
outputcollector.cpp outputcollector.h
pdb/pdbengine.cpp pdb/pdbengine.h
peripheralregisterhandler.cpp peripheralregisterhandler.h

View File

@@ -135,7 +135,6 @@ include(pdb/pdb.pri)
include(lldb/lldb.pri)
include(uvsc/uvsc.pri)
include(qml/qml.pri)
include(namedemangler/namedemangler.pri)
include(console/console.pri)
include(analyzer/analyzer.pri)

View File

@@ -138,17 +138,6 @@ Project {
]
}
Group {
name: "Name Demangler"
prefix: "namedemangler/"
files: [
"demanglerexceptions.h",
"globalparsestate.cpp", "globalparsestate.h",
"namedemangler.cpp", "namedemangler.h",
"parsetreenodes.cpp", "parsetreenodes.h",
]
}
Group {
name: "QML Debugger"
prefix: "qml/"

View File

@@ -1,75 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QtGlobal>
#include <QSharedPointer>
#include <QString>
namespace Debugger {
namespace Internal {
class ParseTreeNode;
class ParseException
{
public:
ParseException(const QString &error) : error(error) {}
const QString error;
};
class InternalDemanglerException
{
public:
InternalDemanglerException(const QString &func, const QString &file, int line)
: func(func), file(file), line(line) {}
QString func;
QString file;
int line;
};
#define DEMANGLER_ASSERT(cond) \
do { \
if (!(cond)) { \
throw InternalDemanglerException(Q_FUNC_INFO, __FILE__, __LINE__); \
} \
} while (0)
template <typename T> QSharedPointer<T> demanglerCast(const QSharedPointer<ParseTreeNode> &node,
const QString &func, const QString &file, int line)
{
const QSharedPointer<T> out = node.dynamicCast<T>();
if (!out)
throw InternalDemanglerException(func, file, line);
return out;
}
#define DEMANGLER_CAST(type, input) demanglerCast<type>(input, Q_FUNC_INFO, __FILE__, __LINE__)
} // namespace Internal
} // namespace Debugger

View File

@@ -1,69 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "globalparsestate.h"
#include "demanglerexceptions.h"
#include "parsetreenodes.h"
namespace Debugger {
namespace Internal {
char GlobalParseState::peek(int ahead)
{
Q_ASSERT(m_pos >= 0);
if (m_pos + ahead < m_mangledName.size())
return m_mangledName[m_pos + ahead];
return eoi;
}
char GlobalParseState::advance(int steps)
{
Q_ASSERT(steps > 0);
if (m_pos + steps > m_mangledName.size())
throw ParseException("Unexpected end of input");
const char c = m_mangledName[m_pos];
m_pos += steps;
return c;
}
QByteArray GlobalParseState::readAhead(int charCount) const
{
QByteArray str;
if (m_pos + charCount <= m_mangledName.size())
str = m_mangledName.mid(m_pos, charCount);
else
str.fill(eoi, charCount);
return str;
}
void GlobalParseState::addSubstitution(const QSharedPointer<ParseTreeNode> &node)
{
m_substitutions << node->clone();
}
} // namespace Internal
} // namespace Debugger

View File

@@ -1,69 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QByteArray>
#include <QSharedPointer>
#include <QStack>
namespace Debugger {
namespace Internal {
class NameDemanglerPrivate;
class ParseTreeNode;
class GlobalParseState
{
friend class NameDemanglerPrivate;
public:
char peek(int ahead = 0);
char advance(int steps = 1);
QByteArray readAhead(int charCount) const;
int stackElementCount() const { return m_parseStack.count(); }
QSharedPointer<ParseTreeNode> stackTop() const { return m_parseStack.top(); }
QSharedPointer<ParseTreeNode> stackElementAt(int index) const { return m_parseStack.at(index); }
void pushToStack(const QSharedPointer<ParseTreeNode> &node) { m_parseStack.push(node); }
QSharedPointer<ParseTreeNode> popFromStack() { return m_parseStack.pop(); }
int substitutionCount() const { return m_substitutions.count(); }
QSharedPointer<ParseTreeNode> substitutionAt(int index) const { return m_substitutions.at(index); }
void addSubstitution(const QSharedPointer<ParseTreeNode> &node);
int templateParamCount() const { return m_templateParams.count(); }
QSharedPointer<ParseTreeNode> templateParamAt(int index) const { return m_templateParams.at(index); }
void addTemplateParam(const QSharedPointer<ParseTreeNode> &node) { m_templateParams << node; }
private:
int m_pos = 0;
QByteArray m_mangledName;
QList<QSharedPointer<ParseTreeNode> > m_substitutions;
QList<QSharedPointer<ParseTreeNode> > m_templateParams;
QStack<QSharedPointer<ParseTreeNode> > m_parseStack;
static const char eoi = '$';
};
} // namespace Internal
} // namespace Debugger

View File

@@ -1,116 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "namedemangler.h"
#include "demanglerexceptions.h"
#include "parsetreenodes.h"
#include <limits>
namespace Debugger {
namespace Internal {
class NameDemanglerPrivate
{
public:
bool demangle(const QString &mangledName);
const QString &errorString() const { return m_errorString; }
const QString &demangledName() const { return m_demangledName; }
private:
GlobalParseState m_parseState;
QString m_errorString;
QString m_demangledName;
};
bool NameDemanglerPrivate::demangle(const QString &mangledName)
{
bool success;
try {
m_parseState.m_mangledName = mangledName.toLatin1();
m_parseState.m_pos = 0;
m_demangledName.clear();
if (!MangledNameRule::mangledRepresentationStartsWith(m_parseState.peek())) {
m_demangledName = QLatin1String(m_parseState.m_mangledName);
return true;
}
MangledNameRule::parse(&m_parseState, ParseTreeNode::Ptr());
if (m_parseState.m_pos != m_parseState.m_mangledName.size())
throw ParseException("Unconsumed input");
if (m_parseState.m_parseStack.count() != 1) {
throw ParseException(QString::fromLatin1("There are %1 elements on the parse stack; "
"expected one.").arg(m_parseState.m_parseStack.count()));
}
// Uncomment for debugging.
//m_parseState.stackTop()->print(0);
m_demangledName = QLatin1String(m_parseState.stackTop()->toByteArray());
success = true;
} catch (const ParseException &p) {
m_errorString = QString::fromLatin1("Parse error at index %1 of mangled name \"%2\": %3.")
.arg(m_parseState.m_pos).arg(mangledName, p.error);
success = false;
} catch (const InternalDemanglerException &e) {
m_errorString = QString::fromLatin1("Internal demangler error at function %1, file %2, "
"line %3").arg(e.func, e.file).arg(e.line);
success = false;
}
m_parseState.m_parseStack.clear();
m_parseState.m_substitutions.clear();
m_parseState.m_templateParams.clear();
return success;
}
NameDemangler::NameDemangler() : d(new NameDemanglerPrivate) { }
NameDemangler::~NameDemangler()
{
delete d;
}
bool NameDemangler::demangle(const QString &mangledName)
{
return d->demangle(mangledName);
}
QString NameDemangler::errorString() const
{
return d->errorString();
}
QString NameDemangler::demangledName() const
{
return d->demangledName();
}
} // namespace Internal
} // namespace Debugger

View File

@@ -1,71 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QtGlobal>
QT_BEGIN_NAMESPACE
class QString;
QT_END_NAMESPACE
namespace Debugger {
namespace Internal {
class NameDemanglerPrivate;
class NameDemangler
{
public:
NameDemangler();
~NameDemangler();
/*
* Demangles a mangled name. Also accepts a non-demangled name,
* in which case it is not transformed.
* Returns true <=> the name is not mangled or it is mangled correctly
* according to the specification.
*/
bool demangle(const QString &mangledName);
/*
* A textual description of the error encountered, if there was one.
* Only valid if demangle() returned false.
*/
QString errorString() const;
/*
* The demangled name. If the original name was not mangled, this
* is identical to the input.
* Only valid if demangle() returned true.
*/
QString demangledName() const;
private:
NameDemanglerPrivate *d;
};
} // namespace Internal
} // namespace Debugger

View File

@@ -1,10 +0,0 @@
HEADERS += \
$$PWD/namedemangler.h \
$$PWD/parsetreenodes.h \
$$PWD/demanglerexceptions.h \
$$PWD/globalparsestate.h
SOURCES += \
$$PWD/namedemangler.cpp \
$$PWD/parsetreenodes.cpp \
$$PWD/globalparsestate.cpp

File diff suppressed because it is too large Load Diff

View File

@@ -1,830 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "globalparsestate.h"
namespace Debugger {
namespace Internal {
class ParseTreeNode
{
public:
using Ptr = QSharedPointer<ParseTreeNode>;
virtual ~ParseTreeNode();
virtual QByteArray toByteArray() const = 0;
virtual ParseTreeNode::Ptr clone() const = 0;
int childCount() const { return m_children.count(); }
void addChild(ParseTreeNode::Ptr childNode) { m_children << childNode; }
ParseTreeNode::Ptr childAt(int i, const QString &func, const QString &file, int line) const;
QByteArray pasteAllChildren() const;
void print(int indentation) const; // For debugging.
template <typename T> static Ptr parseRule(GlobalParseState *parseState)
{
const Ptr node = Ptr(new T(parseState));
parseState->pushToStack(node);
parseState->stackTop()->parse();
return node;
}
protected:
ParseTreeNode(GlobalParseState *parseState) : m_parseState(parseState) {}
ParseTreeNode(const ParseTreeNode &other);
QByteArray bool2String(bool b) const;
GlobalParseState *parseState() const { return m_parseState; }
private:
virtual void parse() = 0;
virtual QByteArray description() const = 0; // For debugging.
QList<ParseTreeNode::Ptr > m_children; // Convention: Children are inserted in parse order.
GlobalParseState * const m_parseState;
};
class ArrayTypeNode : public ParseTreeNode
{
public:
ArrayTypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
ArrayTypeNode(const ArrayTypeNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new ArrayTypeNode(*this)); }
void parse() override;
QByteArray description() const override { return "ArrayType"; }
};
class BareFunctionTypeNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<BareFunctionTypeNode>;
BareFunctionTypeNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c);
bool hasReturnType() const { return m_hasReturnType; }
QByteArray toByteArray() const override;
private:
BareFunctionTypeNode(const BareFunctionTypeNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new BareFunctionTypeNode(*this)); }
void parse() override;
QByteArray description() const override;
bool m_hasReturnType = false;
};
class BuiltinTypeNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<BuiltinTypeNode>;
BuiltinTypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
enum Type {
VoidType, WCharType, BoolType,
PlainCharType, SignedCharType, UnsignedCharType, SignedShortType, UnsignedShortType,
SignedIntType, UnsignedIntType, SignedLongType, UnsignedLongType,
SignedLongLongType, UnsignedLongLongType, SignedInt128Type, UnsignedInt128Type,
FloatType, DoubleType, LongDoubleType, Float128Type, EllipsisType,
DecimalFloatingType64, DecimalFloatingType128, DecimalFloatingType32,
DecimalFloatingType16, Char32Type, Char16Type, AutoType, NullPtrType, VendorType
};
Type type() const { return m_type; }
private:
BuiltinTypeNode(const BuiltinTypeNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new BuiltinTypeNode(*this)); }
void parse() override;
QByteArray description() const override;
Type m_type; // TODO: define?
};
class CallOffsetRule
{
public:
static bool mangledRepresentationStartsWith(char c);
static void parse(GlobalParseState *parseState);
private:
CallOffsetRule();
};
class NvOffsetNode : public ParseTreeNode
{
public:
NvOffsetNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
QByteArray toByteArray() const override { return QByteArray(); } // TODO: How to encode this?
private:
NvOffsetNode(const NvOffsetNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new NvOffsetNode(*this)); }
void parse() override;
QByteArray description() const override { return "NvOffset"; }
};
class VOffsetNode : public ParseTreeNode
{
public:
VOffsetNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
QByteArray toByteArray() const override { return QByteArray(); } // TODO: How to encode this?
private:
VOffsetNode(const VOffsetNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new VOffsetNode(*this)); }
void parse() override;
QByteArray description() const override { return "VOffset"; }
};
class ClassEnumTypeRule
{
public:
static bool mangledRepresentationStartsWith(char c);
static void parse(GlobalParseState *parseState);
private:
ClassEnumTypeRule();
};
class DiscriminatorRule
{
public:
static bool mangledRepresentationStartsWith(char c);
static void parse(GlobalParseState *parseState);
private:
DiscriminatorRule();
};
class CtorDtorNameNode : public ParseTreeNode
{
public:
CtorDtorNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
CtorDtorNameNode(const CtorDtorNameNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new CtorDtorNameNode(*this)); }
void parse() override;
QByteArray description() const override;
bool m_isDestructor; // TODO: define?
QByteArray m_representation;
};
class CvQualifiersNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<CvQualifiersNode>;
CvQualifiersNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c);
bool hasQualifiers() const { return m_hasConst || m_hasVolatile; }
QByteArray toByteArray() const override;
private:
CvQualifiersNode(const CvQualifiersNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new CvQualifiersNode(*this)); }
void parse() override;
QByteArray description() const override { return "CvQualifiers[" + toByteArray() + ']'; }
bool m_hasConst = false;
bool m_hasVolatile = false;
};
class EncodingNode : public ParseTreeNode
{
public:
EncodingNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
EncodingNode(const EncodingNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new EncodingNode(*this)); }
void parse() override;
QByteArray description() const override { return "Encoding"; }
};
class ExpressionNode : public ParseTreeNode
{
public:
ExpressionNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
ExpressionNode(const ExpressionNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new ExpressionNode(*this)); }
void parse() override;
QByteArray description() const override;
enum Type {
ConversionType, SizeofType, AlignofType, OperatorType, ParameterPackSizeType,
NewType, ArrayNewType, DeleteType, ArrayDeleteType, PrefixIncrementType,
PrefixDecrementType, TypeIdTypeType, TypeIdExpressionType, DynamicCastType,
StaticCastType, ConstCastType, ReinterpretCastType, MemberAccessType,
PointerMemberAccessType, MemberDerefType, PackExpansionType, ThrowType,
RethrowType, OtherType
} m_type; // TODO: define?
bool m_globalNamespace = false;
};
class OperatorNameNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<OperatorNameNode>;
OperatorNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
enum Type {
NewType, ArrayNewType, DeleteType, ArrayDeleteType, UnaryPlusType, UnaryMinusType,
UnaryAmpersandType, UnaryStarType, BitwiseNotType, BinaryPlusType, BinaryMinusType,
MultType, DivType, ModuloType, BitwiseAndType, BitwiseOrType, XorType, AssignType,
IncrementAndAssignType, DecrementAndAssignType, MultAndAssignType, DivAndAssignType,
ModuloAndAssignType, BitwiseAndAndAssignType, BitwiseOrAndAssignType, XorAndAssignType,
LeftShiftType, RightShiftType, LeftShiftAndAssignType, RightShiftAndAssignType, EqualsType,
NotEqualsType, LessType, GreaterType, LessEqualType, GreaterEqualType, LogicalNotType,
LogicalAndType, LogicalOrType, IncrementType, DecrementType, CommaType, ArrowStarType,
ArrowType, CallType, IndexType, TernaryType, SizeofTypeType, SizeofExprType,
AlignofTypeType, AlignofExprType, CastType, VendorType
};
Type type() const { return m_type; }
QByteArray toByteArray() const override;
private:
OperatorNameNode(const OperatorNameNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new OperatorNameNode(*this)); }
void parse() override;
QByteArray description() const override;
Type m_type = VendorType;
};
class ExprPrimaryNode : public ParseTreeNode
{
public:
ExprPrimaryNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
ExprPrimaryNode(const ExprPrimaryNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new ExprPrimaryNode(*this)); }
void parse() override;
QByteArray description() const override;
QByteArray m_suffix;
bool m_isNullPtr = false;
};
class FunctionTypeNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<FunctionTypeNode>;
FunctionTypeNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c);
bool isExternC() const { return m_isExternC; }
QByteArray toByteArray() const override;
private:
FunctionTypeNode(const FunctionTypeNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new FunctionTypeNode(*this)); }
void parse() override;
QByteArray description() const override;
bool m_isExternC = false;
};
class LocalNameNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<LocalNameNode>;
LocalNameNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
bool isTemplate() const;
bool isConstructorOrDestructorOrConversionOperator() const;
CvQualifiersNode::Ptr cvQualifiers() const;
private:
LocalNameNode(const LocalNameNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new LocalNameNode(*this)); }
void parse() override;
QByteArray description() const override;
bool m_isStringLiteral = false;
bool m_isDefaultArg = false;
};
class MangledNameRule
{
public:
static bool mangledRepresentationStartsWith(char c);
static void parse(GlobalParseState *parseState, const ParseTreeNode::Ptr &parentNode);
private:
MangledNameRule();
};
class NumberNode : public ParseTreeNode
{
public:
NumberNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
NumberNode(const NumberNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new NumberNode(*this)); }
void parse() override;
QByteArray description() const override;
bool m_isNegative = false;
};
class SourceNameNode : public ParseTreeNode
{
public:
SourceNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override { return m_name; }
private:
SourceNameNode(const SourceNameNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new SourceNameNode(*this)); }
void parse() override;
QByteArray description() const override;
QByteArray m_name;
};
class UnqualifiedNameNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<UnqualifiedNameNode>;
UnqualifiedNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
bool isConstructorOrDestructorOrConversionOperator() const;
QByteArray toByteArray() const override;
private:
UnqualifiedNameNode(const UnqualifiedNameNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new UnqualifiedNameNode(*this)); }
void parse() override;
QByteArray description() const override { return "UnqualifiedName"; }
};
class UnscopedNameNode : public ParseTreeNode
{
public:
UnscopedNameNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c);
bool isConstructorOrDestructorOrConversionOperator() const;
QByteArray toByteArray() const override;
private:
UnscopedNameNode(const UnscopedNameNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new UnscopedNameNode(*this)); }
void parse() override;
QByteArray description() const override;
bool m_inStdNamespace = false;
};
class NestedNameNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<NestedNameNode>;
NestedNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState ){}
static bool mangledRepresentationStartsWith(char c);
bool isTemplate() const;
bool isConstructorOrDestructorOrConversionOperator() const;
CvQualifiersNode::Ptr cvQualifiers() const;
QByteArray toByteArray() const override;
private:
NestedNameNode(const NestedNameNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new NestedNameNode(*this)); }
void parse() override;
QByteArray description() const override { return "NestedName"; }
};
class SubstitutionNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<SubstitutionNode>;
SubstitutionNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
enum Type {
ActualSubstitutionType, StdType, StdAllocType, StdBasicStringType, FullStdBasicStringType,
StdBasicIStreamType, StdBasicOStreamType, StdBasicIoStreamType
};
Type type() const { return m_type; }
private:
SubstitutionNode(const SubstitutionNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new SubstitutionNode(*this)); }
void parse() override;
QByteArray description() const override;
Type m_type; // TODO: define?
};
class PointerToMemberTypeNode : public ParseTreeNode
{
public:
PointerToMemberTypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
PointerToMemberTypeNode(const PointerToMemberTypeNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new PointerToMemberTypeNode(*this)); }
void parse() override;
QByteArray description() const override { return "PointerToMember"; }
};
class TemplateParamNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<TemplateParamNode>;
TemplateParamNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
int index() const { return m_index; }
QByteArray toByteArray() const override;
private:
TemplateParamNode(const TemplateParamNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new TemplateParamNode(*this)); }
void parse() override;
QByteArray description() const override;
int m_index; // TODO: define?
};
class TemplateArgsNode : public ParseTreeNode
{
public:
TemplateArgsNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
TemplateArgsNode(const TemplateArgsNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new TemplateArgsNode(*this)); }
void parse() override;
QByteArray description() const override { return "TemplateArgs"; }
};
class SpecialNameNode : public ParseTreeNode
{
public:
SpecialNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
SpecialNameNode(const SpecialNameNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new SpecialNameNode(*this)); }
void parse() override;
QByteArray description() const override;
enum Type {
VirtualTableType, VttStructType, TypeInfoType, TypeInfoNameType, GuardVarType,
SingleCallOffsetType, DoubleCallOffsetType
} m_type; // TODO: define?
};
template<int base> class NonNegativeNumberNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<NonNegativeNumberNode<base> >;
NonNegativeNumberNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c) {
// Base can only be 10 or 36.
return (c >= '0' && c <= '9') || (base == 36 && c >= 'A' && c <= 'Z');
}
quint64 number() const { return m_number; }
QByteArray toByteArray() const override;
private:
NonNegativeNumberNode(const NonNegativeNumberNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new NonNegativeNumberNode<base>(*this)); }
void parse() override;
QByteArray description() const override;
quint64 m_number; // TODO: define?
};
class NameNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<NameNode>;
NameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
bool isTemplate() const;
bool isConstructorOrDestructorOrConversionOperator() const;
CvQualifiersNode::Ptr cvQualifiers() const;
QByteArray toByteArray() const override;
private:
NameNode(const NameNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new NameNode(*this)); }
void parse() override;
QByteArray description() const override { return "Name"; }
};
class TemplateArgNode : public ParseTreeNode
{
public:
TemplateArgNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
TemplateArgNode(const TemplateArgNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new TemplateArgNode(*this)); }
void parse() override;
QByteArray description() const override;
bool m_isTemplateArgumentPack = false;
};
class PrefixNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<PrefixNode>;
PrefixNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
bool isTemplate() const;
bool isConstructorOrDestructorOrConversionOperator() const;
QByteArray toByteArray() const override;
private:
PrefixNode(const PrefixNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new PrefixNode(*this)); }
void parse() override;
QByteArray description() const override { return "Prefix"; }
};
class TypeNode : public ParseTreeNode
{
public:
using Ptr = QSharedPointer<TypeNode>;
TypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
enum Type {
QualifiedType, PointerType, ReferenceType, RValueType, VendorType, PackExpansionType,
SubstitutionType, OtherType
};
Type type() const { return m_type; }
QByteArray toByteArray() const override;
private:
TypeNode(const TypeNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new TypeNode(*this)); }
void parse() override;
QByteArray description() const override;
QByteArray toByteArrayQualPointerRef(const TypeNode *typeNode,
const QByteArray &qualPtrRef) const;
QByteArray qualPtrRefListToByteArray(const QList<const ParseTreeNode *> &nodeList) const;
Type m_type = OtherType;
};
class FloatValueNode : public ParseTreeNode
{
public:
FloatValueNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
FloatValueNode(const FloatValueNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new FloatValueNode(*this)); }
void parse() override;
QByteArray description() const override;
double m_value; // TODO: define?
};
class LambdaSigNode : public ParseTreeNode
{
public:
LambdaSigNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
LambdaSigNode(const LambdaSigNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new LambdaSigNode(*this)); }
void parse() override;
QByteArray description() const override { return "LambdaSig"; }
};
class ClosureTypeNameNode : public ParseTreeNode
{
public:
ClosureTypeNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
QByteArray toByteArray() const override;
private:
ClosureTypeNameNode(const ClosureTypeNameNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new ClosureTypeNameNode(*this)); }
void parse() override;
QByteArray description() const override { return "ClosureType"; }
};
class UnnamedTypeNameNode : public ParseTreeNode
{
public:
UnnamedTypeNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
UnnamedTypeNameNode(const UnnamedTypeNameNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new UnnamedTypeNameNode(*this)); }
void parse() override;
QByteArray description() const override { return "UnnnamedType"; }
};
class DeclTypeNode : public ParseTreeNode
{
public:
DeclTypeNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
DeclTypeNode(const DeclTypeNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new DeclTypeNode(*this)); }
void parse() override;
QByteArray description() const override { return "DeclType"; }
};
class UnresolvedTypeRule
{
public:
static bool mangledRepresentationStartsWith(char c);
static void parse(GlobalParseState *parseState);
private:
UnresolvedTypeRule();
};
class SimpleIdNode : public ParseTreeNode
{
public:
SimpleIdNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
SimpleIdNode(const SimpleIdNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new SimpleIdNode(*this)); }
void parse() override;
QByteArray description() const override { return "SimpleId"; }
};
class DestructorNameNode : public ParseTreeNode
{
public:
DestructorNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
DestructorNameNode(const DestructorNameNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new DestructorNameNode(*this)); }
void parse() override;
QByteArray description() const override { return "DesctuctorName"; }
};
class UnresolvedQualifierLevelRule
{
public:
static bool mangledRepresentationStartsWith(char c);
static void parse(GlobalParseState *parseState);
private:
UnresolvedQualifierLevelRule();
};
class BaseUnresolvedNameNode : public ParseTreeNode
{
public:
BaseUnresolvedNameNode(GlobalParseState *parseState);
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
BaseUnresolvedNameNode(const BaseUnresolvedNameNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new BaseUnresolvedNameNode(*this)); }
void parse() override;
QByteArray description() const override;
bool m_isOperator = false;
};
class InitializerNode : public ParseTreeNode
{
public:
InitializerNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
InitializerNode(const InitializerNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new InitializerNode(*this)); }
void parse() override;
QByteArray description() const override { return "Initializer"; }
};
class UnresolvedNameNode : public ParseTreeNode
{
public:
UnresolvedNameNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
UnresolvedNameNode(const UnresolvedNameNode &other);
ParseTreeNode::Ptr clone() const override { return Ptr(new UnresolvedNameNode(*this)); }
void parse() override;
QByteArray description() const override;
bool m_globalNamespace; // TODO: define?
};
class FunctionParamNode : public ParseTreeNode
{
public:
FunctionParamNode(GlobalParseState *parseState) : ParseTreeNode(parseState) {}
static bool mangledRepresentationStartsWith(char c);
QByteArray toByteArray() const override;
private:
FunctionParamNode(const FunctionParamNode &other) = default;
ParseTreeNode::Ptr clone() const override { return Ptr(new FunctionParamNode(*this)); }
void parse() override;
QByteArray description() const override { return "FunctionParam"; }
};
} // namespace Internal
} // namespace Debugger

View File

@@ -32,15 +32,6 @@ add_qtc_test(tst_debugger_gdb
"${DEBUGGERDIR}/debuggerprotocol.cpp" "${DEBUGGERDIR}/debuggerprotocol.h"
)
add_qtc_test(tst_debugger_namedemangler
INCLUDES "${DEBUGGERDIR}"
SOURCES
tst_namedemangler.cpp
"${DEBUGGERDIR}/namedemangler/globalparsestate.cpp" "${DEBUGGERDIR}/namedemangler/globalparsestate.h"
"${DEBUGGERDIR}/namedemangler/namedemangler.cpp" "${DEBUGGERDIR}/namedemangler/namedemangler.h"
"${DEBUGGERDIR}/namedemangler/parsetreenodes.cpp" "${DEBUGGERDIR}/namedemangler/parsetreenodes.h"
)
add_qtc_test(tst_debugger_offsets
DEPENDS Qt5::CorePrivate
INCLUDES "${DEBUGGERDIR}"

View File

@@ -10,7 +10,5 @@ CONFIG += ordered
SUBDIRS += gdb.pro
SUBDIRS += simplifytypes.pro
SUBDIRS += dumpers.pro
SUBDIRS += namedemangler.pro
SUBDIRS += disassembler.pro
SUBDIRS += offsets.pro

View File

@@ -7,7 +7,6 @@ Project {
"disassembler.qbs",
"dumpers.qbs",
"gdb.qbs",
"namedemangler.qbs",
"offsets.qbs",
"simplifytypes.qbs",
]

View File

@@ -1,10 +0,0 @@
QT -= gui
include(../qttest.pri)
DEBUGGERDIR = $$IDE_SOURCE_TREE/src/plugins/debugger
INCLUDEPATH += $$DEBUGGERDIR
SOURCES = tst_namedemangler.cpp
include($$DEBUGGERDIR/namedemangler/namedemangler.pri)

View File

@@ -1,18 +0,0 @@
import qbs
QtcAutotest {
name: "Name demangler autotest"
cpp.enableExceptions: true
Group {
name: "Sources from Debugger plugin"
prefix: project.debuggerDir + "namedemangler/"
files: ["*.h", "*.cpp"]
}
Group {
name: "Test sources"
files: "tst_namedemangler.cpp"
}
cpp.includePaths: base.concat([project.debuggerDir])
}

View File

@@ -1,616 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include <namedemangler/namedemangler.h>
#include <namedemangler/parsetreenodes.h>
#include <QObject>
#include <QDebug>
#include <QTest>
#include <cctype>
const char *toString(char c) { return (QByteArray("'") + c + "'").constData(); }
using namespace Debugger::Internal;
using namespace QTest;
class NameDemanglerAutoTest : public QObject
{
Q_OBJECT
private slots:
void testUnmangledName();
void testDisjunctFirstSets();
void testCorrectlyMangledNames();
void testCorrectlyMangledNames_data();
void testIncorrectlyMangledNames();
private:
void testIncorrectlyMangledName(const QString &mangledName);
NameDemangler demangler;
};
void NameDemanglerAutoTest::testUnmangledName()
{
QVERIFY(demangler.demangle(QLatin1String("f"))
&& demangler.demangledName() == QLatin1String("f"));
}
void NameDemanglerAutoTest::testCorrectlyMangledNames()
{
QFETCH(QString, demangled);
QString mangled = QString::fromLatin1(currentDataTag());
QVERIFY2(demangler.demangle(mangled), qPrintable(demangler.errorString()));
QCOMPARE(demangler.demangledName(), demangled);
}
void NameDemanglerAutoTest::testCorrectlyMangledNames_data()
{
addColumn<QString>("demangled");
newRow("_Z1fv")
<< "f()";
newRow("_Z1fi")
<< "f(int)";
#ifdef Q_OS_LINUX
newRow("_Z3foo3bar")
<< "foo(bar)";
newRow("_Zrm1XS_")
<< "operator%(X, X)";
newRow("_ZplR1XS0_")
<< "operator+(X &, X &)";
newRow("_ZlsRK1XS1_")
<< "operator<<(X const &, X const &)";
newRow("_ZN3FooIA4_iE3barE")
<< "Foo<int[4]>::bar";
newRow("_Z5firstI3DuoEvS0_")
<< "void first<Duo>(Duo)";
newRow("_Z5firstI3DuoEvT_")
<< "void first<Duo>(Duo)";
newRow("_Z3fooIiPFidEiEvv")
<< "void foo<int, int (*)(double), int>()";
newRow("_ZN1N1fE")
<< "N::f";
newRow("_ZN6System5Sound4beepEv")
<< "System::Sound::beep()";
newRow("_ZN5Arena5levelE")
<< "Arena::level";
newRow("_ZN5StackIiiE5levelE")
<< "Stack<int, int>::level";
newRow("_Z1fI1XEvPVN1AIT_E1TE")
<< "void f<X>(A<X>::T volatile *)";
newRow("_ZngILi42EEvN1AIXplT_Li2EEE1TE")
<< "void operator-<42>(A<42 + 2>::T)";
newRow("_Z4makeI7FactoryiET_IT0_Ev")
<< "Factory<int> make<Factory, int>()";
newRow("_Z3foo5Hello5WorldS0_S_")
<< "foo(Hello, World, World, Hello)";
newRow("_Z3fooPM2ABi")
<< "foo(int AB::**)";
newRow("_ZlsRSoRKSs")
<< "operator<<(std::basic_ostream<char, std::char_traits<char> > &, "
"std::basic_string<char, std::char_traits<char>, "
"std::allocator<char> > const &)";
newRow("_ZTI7a_class")
<< "typeid(a_class)";
newRow("_ZZN1A3fooEiE1B")
<< "A::foo(int)::B";
newRow("_ZZ3foovEN1C1DE")
<< "foo()::C::D";
newRow("_ZZZ3foovEN1C3barEvEN1E3bazEv")
<< "foo()::C::bar()::E::baz()";
newRow("_ZZN1N1fEiE1p")
<< "N::f(int)::p";
newRow("_ZZN1N1fEiEs")
<< "N::f(int)::{string literal}";
newRow("_Z41__static_initialization_and_destruction_0ii")
<< "__static_initialization_and_destruction_0(int, int)";
newRow("_ZN20NameDemanglerPrivate3eoiE")
<< "NameDemanglerPrivate::eoi";
newRow("_ZZN20NameDemanglerPrivate15parseIdentifierEiE8__func__")
<< "NameDemanglerPrivate::parseIdentifier(int)::__func__";
newRow("_ZN4QSetI5QCharED1Ev")
<< "QSet<QChar>::~QSet()";
newRow("_Zne5QCharS_")
<< "operator!=(QChar, QChar)";
newRow("_ZN20NameDemanglerPrivate17parseFunctionTypeEv")
<< "NameDemanglerPrivate::parseFunctionType()";
newRow("_ZNK20NameDemanglerPrivate16ArrayNewOperator8makeExprERK11QStringList")
<< "NameDemanglerPrivate::ArrayNewOperator::makeExpr(QStringList const &) const";
newRow("_ZN13QLatin1StringC1EPKc")
<< "QLatin1String::QLatin1String(char const *)";
newRow("_ZN15QtSharedPointer16ExternalRefCountIN20NameDemanglerPrivate8OperatorEE12internalCopyIS2_EEvRKNS0_IT_EE")
<< "void QtSharedPointer::ExternalRefCount<NameDemanglerPrivate::Operator>"
"::internalCopy<NameDemanglerPrivate::Operator>(QtSharedPointer"
"::ExternalRefCount<NameDemanglerPrivate::Operator> const &)";
newRow("_ZN15QtSharedPointer16ExternalRefCountIN20NameDemanglerPrivate8OperatorEE11internalSetEPNS_20ExternalRefCountDataEPS2_")
<< "QtSharedPointer::ExternalRefCount<NameDemanglerPrivate::Operator>"
"::internalSet(QtSharedPointer::ExternalRefCountData *, NameDemanglerPrivate::Operator *)";
newRow("_ZN20NameDemanglerPrivate17parseUnscopedNameEv")
<< "NameDemanglerPrivate::parseUnscopedName()";
newRow("_ZNK7QString3argExiiRK5QChar")
<< "QString::arg(long long, int, int, QChar const &) const";
newRow("_ZN20NameDemanglerPrivate8OperatorC2ERK7QStringS3_")
<< "NameDemanglerPrivate::Operator::Operator(QString const &, QString const &)";
newRow("_ZN15QtSharedPointer16ExternalRefCountIN20NameDemanglerPrivate8OperatorEEC2EN2Qt14InitializationE")
<< "QtSharedPointer::ExternalRefCount<NameDemanglerPrivate::Operator>::ExternalRefCount(Qt::Initialization)";
newRow("_ZN7QString5clearEv")
<< "QString::clear()";
newRow("_ZNK5QListI7QStringE2atEi")
<< "QList<QString>::at(int) const";
newRow("_ZNK7QString10startsWithERKS_N2Qt15CaseSensitivityE")
<< "QString::startsWith(QString const &, Qt::CaseSensitivity) const";
newRow("_ZNK4QSetI5QCharE8constEndEv")
<< "QSet<QChar>::constEnd() const";
newRow("_Z11qt_assert_xPKcS0_S0_i")
<< "qt_assert_x(char const *, char const *, char const *, int)";
newRow("_ZN9QHashData8willGrowEv")
<< "QHashData::willGrow()";
newRow("_ZNK5QHashI5QChar15QHashDummyValueE14const_iteratorneERKS3_")
<< "QHash<QChar, QHashDummyValue>::const_iterator::operator!="
"(QHash<QChar, QHashDummyValue>::const_iterator const &) const";
newRow("_ZNK13NameDemangler11errorStringEv")
<< "NameDemangler::errorString() const";
newRow("_ZN7QString7replaceERK7QRegExpRKS_")
<< "QString::replace(QRegExp const &, QString const &)";
newRow("_ZN7QString4freeEPNS_4DataE")
<< "QString::free(QString::Data *)";
newRow("_ZTSN20NameDemanglerPrivate19ArrayAccessOperatorE")
<< "typeid(NameDemanglerPrivate::ArrayAccessOperator).name()";
newRow("_ZN3ns11fERKPFPKiS1_RKhE")
<< "ns1::f(int const * (* const &)(int const *, unsigned char const &))";
newRow("_Z9test_funcMN3ns11cImEEKFPKvPiRlmE")
<< "test_func(void const * (ns1::c<unsigned long>::*)(int *, long &, unsigned long) const)";
newRow("_ZN3ns11fEPKPFPKiS1_RKhE")
<< "ns1::f(int const * (* const *)(int const *, unsigned char const &))";
newRow("_ZNK1CcviEv")
<< "C::operator int() const";
newRow("_ZN1CppEv")
<< "C::operator++()";
newRow("_ZN1CmmEv")
<< "C::operator--()";
newRow("_ZN1CppEi")
<< "C::operator++(int)";
newRow("_ZN1CmmEi")
<< "C::operator--(int)";
newRow("_ZNK1CcvT_IPKcEEv")
<< "C::operator char const *<char const *>() const";
newRow("_Z9weirdfuncIiEvT_KPFS0_S0_E")
<< "void weirdfunc<int>(int, int (* const)(int))";
newRow("_Z9weirdfuncIiEvT_PFS0_DtfL1p_EE")
<< "void weirdfunc<int>(int, int (*)(decltype({param#1})))";
newRow("_Z9weirdfuncIiEvT_S0_")
<< "void weirdfunc<int>(int, int)";
newRow("_Z9weirdfuncIiEvT_DtfL0p_E")
<< "void weirdfunc<int>(int, decltype({param#1}))";
newRow("_Z9weirdfuncIiEvT_S0_S0_")
<< "void weirdfunc<int>(int, int, int)";
newRow("_Z9weirdfuncIiEvT_S0_DtfL0p0_E")
<< "void weirdfunc<int>(int, int, decltype({param#2}))";
newRow("_Z8toStringIiESsT_")
<< "std::basic_string<char, std::char_traits<char>, std::allocator<char> > toString<int>(int)";
newRow("_Z4funcIRA5_iEvOT_")
<< "void func<int (&)[5]>(int (&)[5])";
newRow("_ZSt9make_pairIiRA5_KcESt4pairINSt17__decay_and_stripIT_E6__typeENS4_IT0_E6__typeEEOS5_OS8_")
<< "std::pair<std::__decay_and_strip<int>::__type, "
"std::__decay_and_strip<char const (&)[5]>::__type> "
"std::make_pair<int, char const (&)[5]>(int &&, char const (&)[5])";
// All examples from the ABI spec.
newRow("_ZN1S1xE")
<< "S::x";
newRow("_Z1fM1AKFvvE")
<< "f(void (A::*)() const)";
newRow("_Z1fIiEvT_")
<< "void f<int>(int)";
newRow("_Z3fooc")
<< "foo(char)";
newRow("_Z2CBIL_Z3foocEE")
<< "CB<foo(char)>";
newRow("_Z2CBIL_Z7IsEmptyEE")
<< "CB<IsEmpty>";
newRow("_ZZ1giEN1S1fE_2i")
<< "g(int)::S::f(int)";
newRow("_ZZ1gvEN1SC1Ev")
<< "g()::S::S()";
newRow("_ZZZ1gvEN1SC1EvEs")
<< "g()::S::S()::{string literal}";
newRow("_ZZ1gvE5str4a")
<< "g()::str4a";
newRow("_ZZ1gvEs_1")
<< "g()::{string literal}";
newRow("_ZZ1gvE5str4b")
<< "g()::str4b";
newRow("_Z1fPFvvEM1SFvvE")
<< "f(void (*)(), void (S::*)())";
newRow("_ZN1N1TIiiE2mfES0_IddE")
<< "N::T<int, int>::mf(N::T<double, double>)";
newRow("_ZSt5state")
<< "std::state";
newRow("_ZNSt3_In4wardE")
<< "std::_In::ward";
newRow("_Z1fN1SUt_E")
<< "f(S::{unnamed type#1})";
newRow("_ZZZ1giEN1S1fE_2iEUt1_")
<< "g(int)::S::f(int)::{unnamed type#3}";
newRow("_ZZZ1giEN1S1fE_2iENUt1_2fxEv")
<< "g(int)::S::f(int)::{unnamed type#3}::fx()";
newRow("_Z1AIcfE")
<< "A<char, float>";
newRow("_Z1fIiEvT_PDtfL0pK_E")
<< "void f<int>(int, decltype({param#1 const}) *)";
newRow("_Z1AILln42EE")
<< "A<-42L>";
newRow("_Z2f1I1QEDTpldtfp_1xdtL_Z1qE1xET_")
<< "decltype({param#1}.x + q.x) f1<Q>(Q)";
newRow("_Z2f2I1QEDTpldtfp_1xsrS0_1xET_")
<< "decltype({param#1}.x + Q::x) f2<Q>(Q)";
newRow("_Z2f3IiEDTplfp_dtL_Z1dEsr1B1XIT_EE1xES1_")
<< "decltype({param#1} + d.B::X<int>::x) f3<int>(int)";
newRow("_Z3fooILi2EEvRAplT_Li1E_i")
<< "void foo<2>(int (&)[2 + 1])";
newRow("_ZZ1giENKUlvE_clEv")
<< "g(int)::{lambda()#1}::operator()() const";
newRow("_ZZ1giENKUlvE0_clEv")
<< "g(int)::{lambda()#2}::operator()() const";
newRow("_ZNK1SIiE1xMUlvE_clEv")
<< "S<int>::x::{lambda()#1}::operator()() const";
newRow("_ZN1S4funcEii")
<< "S::func(int, int)";
// Note: c++filt from binutils 2.22 demangles these wrong (counts default arguments from first instead of from last)
newRow("_ZZN1S1fEiiEd0_NKUlvE_clEv")
<< "S::f(int, int)::{default arg#1}::{lambda()#1}::operator()() const";
newRow("_ZZN1S1fEiiEd0_NKUlvE0_clEv")
<< "S::f(int, int)::{default arg#1}::{lambda()#2}::operator()() const";
newRow("_ZZN1S1fEiiEd_NKUlvE_clEv")
<< "S::f(int, int)::{default arg#2}::{lambda()#1}::operator()() const";
// Note: gcc 4.6.3 encodes this as "_Z2f4I7OpClassEDTadsrT_miES1_".
newRow("_Z2f4I7OpClassEDTadsrT_onmiES0_")
<< "decltype(&OpClass::operator-) f4<OpClass>(OpClass)";
#else
qDebug("Most tests disabled outside Linux");
#endif
}
void NameDemanglerAutoTest::testIncorrectlyMangledNames()
{
}
void NameDemanglerAutoTest::testDisjunctFirstSets()
{
for (char c = 0x20; c < 0x7e; ++c) {
// <encoding>
QVERIFY(!NameNode::mangledRepresentationStartsWith(c)
|| !SpecialNameNode::mangledRepresentationStartsWith(c));
// <name>
QVERIFY(!NestedNameNode::mangledRepresentationStartsWith(c)
|| !UnscopedNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!NestedNameNode::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c));
QVERIFY(!NestedNameNode::mangledRepresentationStartsWith(c)
|| !LocalNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!UnscopedNameNode::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c) || c == 'S');
QVERIFY(!UnscopedNameNode::mangledRepresentationStartsWith(c)
|| !LocalNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!SubstitutionNode::mangledRepresentationStartsWith(c)
|| !LocalNameNode::mangledRepresentationStartsWith(c));
// <nested-name>
QVERIFY(!CvQualifiersNode::mangledRepresentationStartsWith(c)
|| !PrefixNode::mangledRepresentationStartsWith(c) || c == 'r');
// <prefix>
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c));
QVERIFY(!TemplateArgsNode::mangledRepresentationStartsWith(c)
|| !UnqualifiedNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !UnqualifiedNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!SubstitutionNode::mangledRepresentationStartsWith(c)
|| !UnqualifiedNameNode::mangledRepresentationStartsWith(c));
// <template-arg>
QVERIFY(!TypeNode::mangledRepresentationStartsWith(c)
|| !ExprPrimaryNode::mangledRepresentationStartsWith(c));
// <expression>
QVERIFY(!OperatorNameNode::mangledRepresentationStartsWith(c)
|| !TemplateParamNode::mangledRepresentationStartsWith(c));
QVERIFY(!OperatorNameNode::mangledRepresentationStartsWith(c)
|| !FunctionParamNode::mangledRepresentationStartsWith(c));
QVERIFY2(!OperatorNameNode::mangledRepresentationStartsWith(c)
|| !UnresolvedNameNode::mangledRepresentationStartsWith(c)
|| c == 'd' || c == 'g' || c == 'o' || c == 's', toString(c));
QVERIFY(!OperatorNameNode::mangledRepresentationStartsWith(c)
|| !ExprPrimaryNode::mangledRepresentationStartsWith(c));
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !FunctionParamNode::mangledRepresentationStartsWith(c));
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !ExprPrimaryNode::mangledRepresentationStartsWith(c));
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !FunctionParamNode::mangledRepresentationStartsWith(c));
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !UnresolvedNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!FunctionParamNode::mangledRepresentationStartsWith(c)
|| !UnresolvedNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!FunctionParamNode::mangledRepresentationStartsWith(c)
|| !ExprPrimaryNode::mangledRepresentationStartsWith(c));
// <expr-primary>
QVERIFY(!TypeNode::mangledRepresentationStartsWith(c)
|| !MangledNameRule::mangledRepresentationStartsWith(c));
// <type>
QVERIFY(!BuiltinTypeNode::mangledRepresentationStartsWith(c)
|| !FunctionTypeNode::mangledRepresentationStartsWith(c));
QVERIFY2(!BuiltinTypeNode::mangledRepresentationStartsWith(c)
|| !ClassEnumTypeRule::mangledRepresentationStartsWith(c) || c == 'D', toString(c));
QVERIFY(!BuiltinTypeNode::mangledRepresentationStartsWith(c)
|| !ArrayTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!BuiltinTypeNode::mangledRepresentationStartsWith(c)
|| !PointerToMemberTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!BuiltinTypeNode::mangledRepresentationStartsWith(c)
|| !TemplateParamNode::mangledRepresentationStartsWith(c));
QVERIFY(!BuiltinTypeNode::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c));
QVERIFY(!BuiltinTypeNode::mangledRepresentationStartsWith(c)
|| !CvQualifiersNode::mangledRepresentationStartsWith(c));
QVERIFY(!BuiltinTypeNode::mangledRepresentationStartsWith(c)
|| !DeclTypeNode::mangledRepresentationStartsWith(c) || c == 'D');
QVERIFY(!FunctionTypeNode::mangledRepresentationStartsWith(c)
|| !ClassEnumTypeRule::mangledRepresentationStartsWith(c));
QVERIFY(!FunctionTypeNode::mangledRepresentationStartsWith(c)
|| !ArrayTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!FunctionTypeNode::mangledRepresentationStartsWith(c)
|| !PointerToMemberTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!FunctionTypeNode::mangledRepresentationStartsWith(c)
|| !TemplateParamNode::mangledRepresentationStartsWith(c));
QVERIFY(!FunctionTypeNode::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c));
QVERIFY(!FunctionTypeNode::mangledRepresentationStartsWith(c)
|| !CvQualifiersNode::mangledRepresentationStartsWith(c));
QVERIFY(!FunctionTypeNode::mangledRepresentationStartsWith(c)
|| !DeclTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!ClassEnumTypeRule::mangledRepresentationStartsWith(c)
|| !ArrayTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!ClassEnumTypeRule::mangledRepresentationStartsWith(c)
|| !PointerToMemberTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!ClassEnumTypeRule::mangledRepresentationStartsWith(c)
|| !TemplateParamNode::mangledRepresentationStartsWith(c));
QVERIFY(!ClassEnumTypeRule::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c));
QVERIFY(!ClassEnumTypeRule::mangledRepresentationStartsWith(c)
|| !CvQualifiersNode::mangledRepresentationStartsWith(c));
QVERIFY(!ClassEnumTypeRule::mangledRepresentationStartsWith(c)
|| !DeclTypeNode::mangledRepresentationStartsWith(c) || c == 'D');
QVERIFY(!ArrayTypeNode::mangledRepresentationStartsWith(c)
|| !PointerToMemberTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!ArrayTypeNode::mangledRepresentationStartsWith(c)
|| !TemplateParamNode::mangledRepresentationStartsWith(c));
QVERIFY(!ArrayTypeNode::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c));
QVERIFY(!ArrayTypeNode::mangledRepresentationStartsWith(c)
|| !CvQualifiersNode::mangledRepresentationStartsWith(c));
QVERIFY(!ArrayTypeNode::mangledRepresentationStartsWith(c)
|| !DeclTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!PointerToMemberTypeNode::mangledRepresentationStartsWith(c)
|| !TemplateParamNode::mangledRepresentationStartsWith(c));
QVERIFY(!PointerToMemberTypeNode::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c));
QVERIFY(!PointerToMemberTypeNode::mangledRepresentationStartsWith(c)
|| !CvQualifiersNode::mangledRepresentationStartsWith(c));
QVERIFY(!PointerToMemberTypeNode::mangledRepresentationStartsWith(c)
|| !DeclTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c));
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !CvQualifiersNode::mangledRepresentationStartsWith(c));
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !DeclTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!SubstitutionNode::mangledRepresentationStartsWith(c)
|| !CvQualifiersNode::mangledRepresentationStartsWith(c));
QVERIFY(!SubstitutionNode::mangledRepresentationStartsWith(c)
|| !DeclTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!CvQualifiersNode::mangledRepresentationStartsWith(c)
|| !DeclTypeNode::mangledRepresentationStartsWith(c));
// <unqualified-name>
QVERIFY(!OperatorNameNode::mangledRepresentationStartsWith(c)
|| !CtorDtorNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!OperatorNameNode::mangledRepresentationStartsWith(c)
|| !SourceNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!OperatorNameNode::mangledRepresentationStartsWith(c)
|| !UnnamedTypeNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!CtorDtorNameNode::mangledRepresentationStartsWith(c)
|| !SourceNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!CtorDtorNameNode::mangledRepresentationStartsWith(c)
|| !UnnamedTypeNameNode::mangledRepresentationStartsWith(c));
QVERIFY(!SourceNameNode::mangledRepresentationStartsWith(c)
|| !UnnamedTypeNameNode::mangledRepresentationStartsWith(c));
// <array-type>
QVERIFY(!NonNegativeNumberNode<10>::mangledRepresentationStartsWith(c)
|| !ExpressionNode::mangledRepresentationStartsWith(c) || std::isdigit(c));
// <unresolved-type>
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !DeclTypeNode::mangledRepresentationStartsWith(c));
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c));
QVERIFY(!DeclTypeNode::mangledRepresentationStartsWith(c)
|| !SubstitutionNode::mangledRepresentationStartsWith(c));
// <desctructor-name>
QVERIFY(!UnresolvedTypeRule::mangledRepresentationStartsWith(c)
|| !SimpleIdNode::mangledRepresentationStartsWith(c));
}
// <template-args>, <template-arg>
QVERIFY(!TemplateArgNode::mangledRepresentationStartsWith('E'));
// <template-arg>
QVERIFY(!TypeNode::mangledRepresentationStartsWith('X')
&& !TypeNode::mangledRepresentationStartsWith('J')
/* && !TypeNode::mangledRepresentationStartsWith('s') */);
QVERIFY(!ExprPrimaryNode::mangledRepresentationStartsWith('X')
&& !ExprPrimaryNode::mangledRepresentationStartsWith('J')
&& !ExprPrimaryNode::mangledRepresentationStartsWith('s'));
// <expression>
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith('c')
&& !TemplateParamNode::mangledRepresentationStartsWith('s')
&& !TemplateParamNode::mangledRepresentationStartsWith('a'));
QVERIFY(!FunctionParamNode::mangledRepresentationStartsWith('c')
&& !FunctionParamNode::mangledRepresentationStartsWith('c')
&& !FunctionParamNode::mangledRepresentationStartsWith('c'));
QVERIFY(!ExprPrimaryNode::mangledRepresentationStartsWith('c')
&& !ExprPrimaryNode::mangledRepresentationStartsWith('s')
&& !ExprPrimaryNode::mangledRepresentationStartsWith('a'));
QVERIFY(!ExpressionNode::mangledRepresentationStartsWith('E'));
QVERIFY(!ExpressionNode::mangledRepresentationStartsWith('_'));
QVERIFY(!InitializerNode::mangledRepresentationStartsWith('E'));
// <type>
QVERIFY(!BuiltinTypeNode::mangledRepresentationStartsWith('P')
&& !BuiltinTypeNode::mangledRepresentationStartsWith('R')
&& !BuiltinTypeNode::mangledRepresentationStartsWith('O')
&& !BuiltinTypeNode::mangledRepresentationStartsWith('C')
&& !BuiltinTypeNode::mangledRepresentationStartsWith('G')
&& !BuiltinTypeNode::mangledRepresentationStartsWith('U'));
QVERIFY(!FunctionTypeNode::mangledRepresentationStartsWith('P')
&& !FunctionTypeNode::mangledRepresentationStartsWith('R')
&& !FunctionTypeNode::mangledRepresentationStartsWith('O')
&& !FunctionTypeNode::mangledRepresentationStartsWith('C')
&& !FunctionTypeNode::mangledRepresentationStartsWith('G')
&& !FunctionTypeNode::mangledRepresentationStartsWith('U')
&& !FunctionTypeNode::mangledRepresentationStartsWith('D'));
QVERIFY(!ClassEnumTypeRule::mangledRepresentationStartsWith('P')
&& !ClassEnumTypeRule::mangledRepresentationStartsWith('R')
&& !ClassEnumTypeRule::mangledRepresentationStartsWith('O')
&& !ClassEnumTypeRule::mangledRepresentationStartsWith('C')
&& !ClassEnumTypeRule::mangledRepresentationStartsWith('G')
&& !ClassEnumTypeRule::mangledRepresentationStartsWith('U')
/* && !firstSetClassEnumType.contains('D') */);
QVERIFY(!ArrayTypeNode::mangledRepresentationStartsWith('P')
&& !ArrayTypeNode::mangledRepresentationStartsWith('R')
&& !ArrayTypeNode::mangledRepresentationStartsWith('O')
&& !ArrayTypeNode::mangledRepresentationStartsWith('C')
&& !ArrayTypeNode::mangledRepresentationStartsWith('G')
&& !ArrayTypeNode::mangledRepresentationStartsWith('U')
&& !ArrayTypeNode::mangledRepresentationStartsWith('D'));
QVERIFY(!PointerToMemberTypeNode::mangledRepresentationStartsWith('P')
&& !PointerToMemberTypeNode::mangledRepresentationStartsWith('R')
&& !PointerToMemberTypeNode::mangledRepresentationStartsWith('O')
&& !PointerToMemberTypeNode::mangledRepresentationStartsWith('C')
&& !PointerToMemberTypeNode::mangledRepresentationStartsWith('G')
&& !PointerToMemberTypeNode::mangledRepresentationStartsWith('U')
&& !PointerToMemberTypeNode::mangledRepresentationStartsWith('D'));
QVERIFY(!TemplateParamNode::mangledRepresentationStartsWith('P')
&& !TemplateParamNode::mangledRepresentationStartsWith('R')
&& !TemplateParamNode::mangledRepresentationStartsWith('O')
&& !TemplateParamNode::mangledRepresentationStartsWith('C')
&& !TemplateParamNode::mangledRepresentationStartsWith('G')
&& !TemplateParamNode::mangledRepresentationStartsWith('U')
&& !TemplateParamNode::mangledRepresentationStartsWith('D'));
QVERIFY(!SubstitutionNode::mangledRepresentationStartsWith('P')
&& !SubstitutionNode::mangledRepresentationStartsWith('R')
&& !SubstitutionNode::mangledRepresentationStartsWith('O')
&& !SubstitutionNode::mangledRepresentationStartsWith('C')
&& !SubstitutionNode::mangledRepresentationStartsWith('G')
&& !SubstitutionNode::mangledRepresentationStartsWith('U')
&& !SubstitutionNode::mangledRepresentationStartsWith('D'));
QVERIFY(!CvQualifiersNode::mangledRepresentationStartsWith('P')
&& !CvQualifiersNode::mangledRepresentationStartsWith('R')
&& !CvQualifiersNode::mangledRepresentationStartsWith('O')
&& !CvQualifiersNode::mangledRepresentationStartsWith('C')
&& !CvQualifiersNode::mangledRepresentationStartsWith('G')
&& !CvQualifiersNode::mangledRepresentationStartsWith('U')
&& !CvQualifiersNode::mangledRepresentationStartsWith('D'));
QVERIFY(!DeclTypeNode::mangledRepresentationStartsWith('P')
&& !DeclTypeNode::mangledRepresentationStartsWith('R')
&& !DeclTypeNode::mangledRepresentationStartsWith('O')
&& !DeclTypeNode::mangledRepresentationStartsWith('C')
&& !DeclTypeNode::mangledRepresentationStartsWith('G')
&& !DeclTypeNode::mangledRepresentationStartsWith('U'));
// <array-type>
QVERIFY(!NonNegativeNumberNode<10>::mangledRepresentationStartsWith('_'));
QVERIFY(!ExpressionNode::mangledRepresentationStartsWith('_'));
// <substitution>
QVERIFY(!NonNegativeNumberNode<36>::mangledRepresentationStartsWith('_')
&& !NonNegativeNumberNode<36>::mangledRepresentationStartsWith('t')
&& !NonNegativeNumberNode<36>::mangledRepresentationStartsWith('a')
&& !NonNegativeNumberNode<36>::mangledRepresentationStartsWith('b')
&& !NonNegativeNumberNode<36>::mangledRepresentationStartsWith('s')
&& !NonNegativeNumberNode<36>::mangledRepresentationStartsWith('i')
&& !NonNegativeNumberNode<36>::mangledRepresentationStartsWith('o')
&& !NonNegativeNumberNode<36>::mangledRepresentationStartsWith('d'));
// <special-name>
QVERIFY(!CallOffsetRule::mangledRepresentationStartsWith('V')
&& !CallOffsetRule::mangledRepresentationStartsWith('T')
&& !CallOffsetRule::mangledRepresentationStartsWith('I')
&& !CallOffsetRule::mangledRepresentationStartsWith('S')
&& !CallOffsetRule::mangledRepresentationStartsWith('c'));
// <unscoped-name>
QVERIFY(!UnqualifiedNameNode::mangledRepresentationStartsWith('S'));
// <prefix>
QVERIFY(!TemplateArgsNode::mangledRepresentationStartsWith('M'));
QVERIFY(!UnqualifiedNameNode::mangledRepresentationStartsWith('M'));
// <base-unresolved-name>
QVERIFY(!SimpleIdNode::mangledRepresentationStartsWith('o'));
QVERIFY(!SimpleIdNode::mangledRepresentationStartsWith('d'));
// <initializer>
QVERIFY(!ExpressionNode::mangledRepresentationStartsWith('E'));
// <unresolved-name-node>
QVERIFY(!BaseUnresolvedNameNode::mangledRepresentationStartsWith('g'));
QVERIFY(!BaseUnresolvedNameNode::mangledRepresentationStartsWith('s'));
QVERIFY(!UnresolvedTypeRule::mangledRepresentationStartsWith('N'));
QVERIFY(!UnresolvedQualifierLevelRule::mangledRepresentationStartsWith('N'));
QVERIFY(!UnresolvedQualifierLevelRule::mangledRepresentationStartsWith('E'));
}
void NameDemanglerAutoTest::testIncorrectlyMangledName(
const QString &mangledName)
{
QVERIFY(!demangler.demangle(mangledName));
}
QTEST_MAIN(NameDemanglerAutoTest)
#include "tst_namedemangler.moc"