mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[demangler] Tweak how parameter pack sizes are determined.
Rather than eagerly propagating up parameter pack sizes in Node ctors, find the parameter pack size during printing. This is being done to support back-patching forward referencing <template-param>s. llvm-svn: 328463
This commit is contained in:
parent
1043b33b88
commit
f962a81231
@ -101,6 +101,7 @@ public:
|
|||||||
/// If a ParameterPackExpansion (or similar type) is encountered, the offset
|
/// If a ParameterPackExpansion (or similar type) is encountered, the offset
|
||||||
/// into the pack that we're currently printing.
|
/// into the pack that we're currently printing.
|
||||||
unsigned CurrentPackIndex = std::numeric_limits<unsigned>::max();
|
unsigned CurrentPackIndex = std::numeric_limits<unsigned>::max();
|
||||||
|
unsigned CurrentPackMax = std::numeric_limits<unsigned>::max();
|
||||||
|
|
||||||
OutputStream &operator+=(StringView R) {
|
OutputStream &operator+=(StringView R) {
|
||||||
size_t Size = R.size();
|
size_t Size = R.size();
|
||||||
@ -118,7 +119,8 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t getCurrentPosition() const { return CurrentPosition; };
|
size_t getCurrentPosition() const { return CurrentPosition; }
|
||||||
|
void setCurrentPosition(size_t NewPos) { CurrentPosition = NewPos; }
|
||||||
|
|
||||||
char back() const {
|
char back() const {
|
||||||
return CurrentPosition ? Buffer[CurrentPosition - 1] : '\0';
|
return CurrentPosition ? Buffer[CurrentPosition - 1] : '\0';
|
||||||
@ -195,10 +197,6 @@ public:
|
|||||||
KBracedRangeExpr,
|
KBracedRangeExpr,
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr unsigned NoParameterPack =
|
|
||||||
std::numeric_limits<unsigned>::max();
|
|
||||||
unsigned ParameterPackSize = NoParameterPack;
|
|
||||||
|
|
||||||
Kind K;
|
Kind K;
|
||||||
|
|
||||||
/// Three-way bool to track a cached value. Unknown is possible if this node
|
/// Three-way bool to track a cached value. Unknown is possible if this node
|
||||||
@ -217,17 +215,11 @@ public:
|
|||||||
/// affect how we format the output string.
|
/// affect how we format the output string.
|
||||||
Cache FunctionCache;
|
Cache FunctionCache;
|
||||||
|
|
||||||
Node(Kind K_, unsigned ParameterPackSize_ = NoParameterPack,
|
Node(Kind K_, Cache RHSComponentCache_ = Cache::No,
|
||||||
Cache RHSComponentCache_ = Cache::No, Cache ArrayCache_ = Cache::No,
|
Cache ArrayCache_ = Cache::No, Cache FunctionCache_ = Cache::No)
|
||||||
Cache FunctionCache_ = Cache::No)
|
: K(K_), RHSComponentCache(RHSComponentCache_), ArrayCache(ArrayCache_),
|
||||||
: ParameterPackSize(ParameterPackSize_), K(K_),
|
|
||||||
RHSComponentCache(RHSComponentCache_), ArrayCache(ArrayCache_),
|
|
||||||
FunctionCache(FunctionCache_) {}
|
FunctionCache(FunctionCache_) {}
|
||||||
|
|
||||||
bool containsUnexpandedParameterPack() const {
|
|
||||||
return ParameterPackSize != NoParameterPack;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasRHSComponent(OutputStream &S) const {
|
bool hasRHSComponent(OutputStream &S) const {
|
||||||
if (RHSComponentCache != Cache::Unknown)
|
if (RHSComponentCache != Cache::Unknown)
|
||||||
return RHSComponentCache == Cache::Yes;
|
return RHSComponentCache == Cache::Yes;
|
||||||
@ -252,10 +244,6 @@ public:
|
|||||||
virtual bool hasArraySlow(OutputStream &) const { return false; }
|
virtual bool hasArraySlow(OutputStream &) const { return false; }
|
||||||
virtual bool hasFunctionSlow(OutputStream &) const { return false; }
|
virtual bool hasFunctionSlow(OutputStream &) const { return false; }
|
||||||
|
|
||||||
/// If this node is a pack expansion that expands to 0 elements. This can have
|
|
||||||
/// an effect on how we should format the output.
|
|
||||||
bool isEmptyPackExpansion() const;
|
|
||||||
|
|
||||||
void print(OutputStream &S) const {
|
void print(OutputStream &S) const {
|
||||||
printLeft(S);
|
printLeft(S);
|
||||||
if (RHSComponentCache != Cache::No)
|
if (RHSComponentCache != Cache::No)
|
||||||
@ -308,12 +296,20 @@ public:
|
|||||||
void printWithComma(OutputStream &S) const {
|
void printWithComma(OutputStream &S) const {
|
||||||
bool FirstElement = true;
|
bool FirstElement = true;
|
||||||
for (size_t Idx = 0; Idx != NumElements; ++Idx) {
|
for (size_t Idx = 0; Idx != NumElements; ++Idx) {
|
||||||
if (Elements[Idx]->isEmptyPackExpansion())
|
size_t BeforeComma = S.getCurrentPosition();
|
||||||
continue;
|
|
||||||
if (!FirstElement)
|
if (!FirstElement)
|
||||||
S += ", ";
|
S += ", ";
|
||||||
FirstElement = false;
|
size_t AfterComma = S.getCurrentPosition();
|
||||||
Elements[Idx]->print(S);
|
Elements[Idx]->print(S);
|
||||||
|
|
||||||
|
// Elements[Idx] is an empty parameter pack expansion, we should erase the
|
||||||
|
// comma we just printed.
|
||||||
|
if (AfterComma == S.getCurrentPosition()) {
|
||||||
|
S.setCurrentPosition(BeforeComma);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
FirstElement = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -340,8 +336,7 @@ class VendorExtQualType final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
VendorExtQualType(Node *Ty_, StringView Ext_)
|
VendorExtQualType(Node *Ty_, StringView Ext_)
|
||||||
: Node(KVendorExtQualType, Ty_->ParameterPackSize),
|
: Node(KVendorExtQualType), Ty(Ty_), Ext(Ext_) {}
|
||||||
Ty(Ty_), Ext(Ext_) {}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
Ty->print(S);
|
Ty->print(S);
|
||||||
@ -383,7 +378,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QualType(Node *Child_, Qualifiers Quals_)
|
QualType(Node *Child_, Qualifiers Quals_)
|
||||||
: Node(KQualType, Child_->ParameterPackSize, Child_->RHSComponentCache,
|
: Node(KQualType, Child_->RHSComponentCache,
|
||||||
Child_->ArrayCache, Child_->FunctionCache),
|
Child_->ArrayCache, Child_->FunctionCache),
|
||||||
Quals(Quals_), Child(Child_) {}
|
Quals(Quals_), Child(Child_) {}
|
||||||
|
|
||||||
@ -410,7 +405,7 @@ class ConversionOperatorType final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ConversionOperatorType(Node *Ty_)
|
ConversionOperatorType(Node *Ty_)
|
||||||
: Node(KConversionOperatorType, Ty_->ParameterPackSize), Ty(Ty_) {}
|
: Node(KConversionOperatorType), Ty(Ty_) {}
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "operator ";
|
S += "operator ";
|
||||||
@ -424,8 +419,7 @@ class PostfixQualifiedType final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PostfixQualifiedType(Node *Ty_, StringView Postfix_)
|
PostfixQualifiedType(Node *Ty_, StringView Postfix_)
|
||||||
: Node(KPostfixQualifiedType, Ty_->ParameterPackSize),
|
: Node(KPostfixQualifiedType), Ty(Ty_), Postfix(Postfix_) {}
|
||||||
Ty(Ty_), Postfix(Postfix_) {}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &s) const override {
|
void printLeft(OutputStream &s) const override {
|
||||||
Ty->printLeft(s);
|
Ty->printLeft(s);
|
||||||
@ -450,9 +444,7 @@ class ElaboratedTypeSpefType : public Node {
|
|||||||
Node *Child;
|
Node *Child;
|
||||||
public:
|
public:
|
||||||
ElaboratedTypeSpefType(StringView Kind_, Node *Child_)
|
ElaboratedTypeSpefType(StringView Kind_, Node *Child_)
|
||||||
: Node(KElaboratedTypeSpefType), Kind(Kind_), Child(Child_) {
|
: Node(KElaboratedTypeSpefType), Kind(Kind_), Child(Child_) {}
|
||||||
ParameterPackSize = Child->ParameterPackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += Kind;
|
S += Kind;
|
||||||
@ -466,7 +458,7 @@ class AbiTagAttr final : public Node {
|
|||||||
StringView Tag;
|
StringView Tag;
|
||||||
public:
|
public:
|
||||||
AbiTagAttr(const Node* Base_, StringView Tag_)
|
AbiTagAttr(const Node* Base_, StringView Tag_)
|
||||||
: Node(KAbiTagAttr, Base_->ParameterPackSize, Base_->RHSComponentCache,
|
: Node(KAbiTagAttr, Base_->RHSComponentCache,
|
||||||
Base_->ArrayCache, Base_->FunctionCache),
|
Base_->ArrayCache, Base_->FunctionCache),
|
||||||
Base(Base_), Tag(Tag_) {}
|
Base(Base_), Tag(Tag_) {}
|
||||||
|
|
||||||
@ -519,8 +511,7 @@ class PointerType final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PointerType(Node *Pointee_)
|
PointerType(Node *Pointee_)
|
||||||
: Node(KPointerType, Pointee_->ParameterPackSize,
|
: Node(KPointerType, Pointee_->RHSComponentCache),
|
||||||
Pointee_->RHSComponentCache),
|
|
||||||
Pointee(Pointee_) {}
|
Pointee(Pointee_) {}
|
||||||
|
|
||||||
bool hasRHSComponentSlow(OutputStream &S) const override {
|
bool hasRHSComponentSlow(OutputStream &S) const override {
|
||||||
@ -560,8 +551,7 @@ class LValueReferenceType final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
LValueReferenceType(Node *Pointee_)
|
LValueReferenceType(Node *Pointee_)
|
||||||
: Node(KLValueReferenceType, Pointee_->ParameterPackSize,
|
: Node(KLValueReferenceType, Pointee_->RHSComponentCache),
|
||||||
Pointee_->RHSComponentCache),
|
|
||||||
Pointee(Pointee_) {}
|
Pointee(Pointee_) {}
|
||||||
|
|
||||||
bool hasRHSComponentSlow(OutputStream &S) const override {
|
bool hasRHSComponentSlow(OutputStream &S) const override {
|
||||||
@ -589,8 +579,7 @@ class RValueReferenceType final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
RValueReferenceType(Node *Pointee_)
|
RValueReferenceType(Node *Pointee_)
|
||||||
: Node(KRValueReferenceType, Pointee_->ParameterPackSize,
|
: Node(KRValueReferenceType, Pointee_->RHSComponentCache),
|
||||||
Pointee_->RHSComponentCache),
|
|
||||||
Pointee(Pointee_) {}
|
Pointee(Pointee_) {}
|
||||||
|
|
||||||
bool hasRHSComponentSlow(OutputStream &S) const override {
|
bool hasRHSComponentSlow(OutputStream &S) const override {
|
||||||
@ -620,10 +609,7 @@ class PointerToMemberType final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PointerToMemberType(Node *ClassType_, Node *MemberType_)
|
PointerToMemberType(Node *ClassType_, Node *MemberType_)
|
||||||
: Node(KPointerToMemberType,
|
: Node(KPointerToMemberType, MemberType_->RHSComponentCache),
|
||||||
std::min(MemberType_->ParameterPackSize,
|
|
||||||
ClassType_->ParameterPackSize),
|
|
||||||
MemberType_->RHSComponentCache),
|
|
||||||
ClassType(ClassType_), MemberType(MemberType_) {}
|
ClassType(ClassType_), MemberType(MemberType_) {}
|
||||||
|
|
||||||
bool hasRHSComponentSlow(OutputStream &S) const override {
|
bool hasRHSComponentSlow(OutputStream &S) const override {
|
||||||
@ -689,18 +675,14 @@ class ArrayType final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ArrayType(Node *Base_, NodeOrString Dimension_)
|
ArrayType(Node *Base_, NodeOrString Dimension_)
|
||||||
: Node(KArrayType, Base_->ParameterPackSize,
|
: Node(KArrayType,
|
||||||
/*RHSComponentCache=*/Cache::Yes,
|
/*RHSComponentCache=*/Cache::Yes,
|
||||||
/*ArrayCache=*/Cache::Yes),
|
/*ArrayCache=*/Cache::Yes),
|
||||||
Base(Base_), Dimension(Dimension_) {
|
Base(Base_), Dimension(Dimension_) {}
|
||||||
if (Dimension.isNode())
|
|
||||||
ParameterPackSize =
|
|
||||||
std::min(ParameterPackSize, Dimension.asNode()->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Incomplete array type.
|
// Incomplete array type.
|
||||||
ArrayType(Node *Base_)
|
ArrayType(Node *Base_)
|
||||||
: Node(KArrayType, Base_->ParameterPackSize,
|
: Node(KArrayType,
|
||||||
/*RHSComponentCache=*/Cache::Yes,
|
/*RHSComponentCache=*/Cache::Yes,
|
||||||
/*ArrayCache=*/Cache::Yes),
|
/*ArrayCache=*/Cache::Yes),
|
||||||
Base(Base_) {}
|
Base(Base_) {}
|
||||||
@ -733,17 +715,11 @@ class FunctionType final : public Node {
|
|||||||
public:
|
public:
|
||||||
FunctionType(Node *Ret_, NodeArray Params_, Qualifiers CVQuals_,
|
FunctionType(Node *Ret_, NodeArray Params_, Qualifiers CVQuals_,
|
||||||
FunctionRefQual RefQual_, Node *ExceptionSpec_)
|
FunctionRefQual RefQual_, Node *ExceptionSpec_)
|
||||||
: Node(KFunctionType, Ret_->ParameterPackSize,
|
: Node(KFunctionType,
|
||||||
/*RHSComponentCache=*/Cache::Yes, /*ArrayCache=*/Cache::No,
|
/*RHSComponentCache=*/Cache::Yes, /*ArrayCache=*/Cache::No,
|
||||||
/*FunctionCache=*/Cache::Yes),
|
/*FunctionCache=*/Cache::Yes),
|
||||||
Ret(Ret_), Params(Params_), CVQuals(CVQuals_), RefQual(RefQual_),
|
Ret(Ret_), Params(Params_), CVQuals(CVQuals_), RefQual(RefQual_),
|
||||||
ExceptionSpec(ExceptionSpec_) {
|
ExceptionSpec(ExceptionSpec_) {}
|
||||||
for (Node *P : Params)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, P->ParameterPackSize);
|
|
||||||
if (ExceptionSpec != nullptr)
|
|
||||||
ParameterPackSize =
|
|
||||||
std::min(ParameterPackSize, ExceptionSpec->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasRHSComponentSlow(OutputStream &) const override { return true; }
|
bool hasRHSComponentSlow(OutputStream &) const override { return true; }
|
||||||
bool hasFunctionSlow(OutputStream &) const override { return true; }
|
bool hasFunctionSlow(OutputStream &) const override { return true; }
|
||||||
@ -788,7 +764,7 @@ public:
|
|||||||
class NoexceptSpec : public Node {
|
class NoexceptSpec : public Node {
|
||||||
Node *E;
|
Node *E;
|
||||||
public:
|
public:
|
||||||
NoexceptSpec(Node *E_) : Node(KNoexceptSpec, E_->ParameterPackSize), E(E_) {}
|
NoexceptSpec(Node *E_) : Node(KNoexceptSpec), E(E_) {}
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "noexcept(";
|
S += "noexcept(";
|
||||||
@ -801,10 +777,7 @@ class DynamicExceptionSpec : public Node {
|
|||||||
NodeArray Types;
|
NodeArray Types;
|
||||||
public:
|
public:
|
||||||
DynamicExceptionSpec(NodeArray Types_)
|
DynamicExceptionSpec(NodeArray Types_)
|
||||||
: Node(KDynamicExceptionSpec), Types(Types_) {
|
: Node(KDynamicExceptionSpec), Types(Types_) {}
|
||||||
for (Node *T : Types)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, T->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "throw(";
|
S += "throw(";
|
||||||
@ -824,16 +797,11 @@ class FunctionEncoding final : public Node {
|
|||||||
public:
|
public:
|
||||||
FunctionEncoding(Node *Ret_, Node *Name_, NodeArray Params_,
|
FunctionEncoding(Node *Ret_, Node *Name_, NodeArray Params_,
|
||||||
Node *Attrs_, Qualifiers CVQuals_, FunctionRefQual RefQual_)
|
Node *Attrs_, Qualifiers CVQuals_, FunctionRefQual RefQual_)
|
||||||
: Node(KFunctionEncoding, NoParameterPack,
|
: Node(KFunctionEncoding,
|
||||||
/*RHSComponentCache=*/Cache::Yes, /*ArrayCache=*/Cache::No,
|
/*RHSComponentCache=*/Cache::Yes, /*ArrayCache=*/Cache::No,
|
||||||
/*FunctionCache=*/Cache::Yes),
|
/*FunctionCache=*/Cache::Yes),
|
||||||
Ret(Ret_), Name(Name_), Params(Params_), Attrs(Attrs_),
|
Ret(Ret_), Name(Name_), Params(Params_), Attrs(Attrs_),
|
||||||
CVQuals(CVQuals_), RefQual(RefQual_) {
|
CVQuals(CVQuals_), RefQual(RefQual_) {}
|
||||||
for (Node *P : Params)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, P->ParameterPackSize);
|
|
||||||
if (Ret)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, Ret->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasRHSComponentSlow(OutputStream &) const override { return true; }
|
bool hasRHSComponentSlow(OutputStream &) const override { return true; }
|
||||||
bool hasFunctionSlow(OutputStream &) const override { return true; }
|
bool hasFunctionSlow(OutputStream &) const override { return true; }
|
||||||
@ -877,8 +845,7 @@ class LiteralOperator : public Node {
|
|||||||
const Node *OpName;
|
const Node *OpName;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LiteralOperator(Node *OpName_)
|
LiteralOperator(Node *OpName_) : Node(KLiteralOperator), OpName(OpName_) {}
|
||||||
: Node(KLiteralOperator, OpName_->ParameterPackSize), OpName(OpName_) {}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "operator\"\" ";
|
S += "operator\"\" ";
|
||||||
@ -892,8 +859,7 @@ class SpecialName final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SpecialName(StringView Special_, Node* Child_)
|
SpecialName(StringView Special_, Node* Child_)
|
||||||
: Node(KSpecialName, Child_->ParameterPackSize), Special(Special_),
|
: Node(KSpecialName), Special(Special_), Child(Child_) {}
|
||||||
Child(Child_) {}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += Special;
|
S += Special;
|
||||||
@ -907,8 +873,7 @@ class CtorVtableSpecialName final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CtorVtableSpecialName(Node *FirstType_, Node *SecondType_)
|
CtorVtableSpecialName(Node *FirstType_, Node *SecondType_)
|
||||||
: Node(KCtorVtableSpecialName, std::min(FirstType_->ParameterPackSize,
|
: Node(KCtorVtableSpecialName),
|
||||||
SecondType_->ParameterPackSize)),
|
|
||||||
FirstType(FirstType_), SecondType(SecondType_) {}
|
FirstType(FirstType_), SecondType(SecondType_) {}
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
@ -926,9 +891,7 @@ class QualifiedName final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QualifiedName(Node* Qualifier_, Node* Name_)
|
QualifiedName(Node* Qualifier_, Node* Name_)
|
||||||
: Node(KQualifiedName,
|
: Node(KQualifiedName), Qualifier(Qualifier_), Name(Name_) {}
|
||||||
std::min(Qualifier_->ParameterPackSize, Name_->ParameterPackSize)),
|
|
||||||
Qualifier(Qualifier_), Name(Name_) {}
|
|
||||||
|
|
||||||
StringView getBaseName() const override { return Name->getBaseName(); }
|
StringView getBaseName() const override { return Name->getBaseName(); }
|
||||||
|
|
||||||
@ -953,17 +916,10 @@ class VectorType final : public Node {
|
|||||||
public:
|
public:
|
||||||
VectorType(NodeOrString Dimension_)
|
VectorType(NodeOrString Dimension_)
|
||||||
: Node(KVectorType), BaseType(nullptr), Dimension(Dimension_),
|
: Node(KVectorType), BaseType(nullptr), Dimension(Dimension_),
|
||||||
IsPixel(true) {
|
IsPixel(true) {}
|
||||||
if (Dimension.isNode())
|
|
||||||
ParameterPackSize = Dimension.asNode()->ParameterPackSize;
|
|
||||||
}
|
|
||||||
VectorType(Node *BaseType_, NodeOrString Dimension_)
|
VectorType(Node *BaseType_, NodeOrString Dimension_)
|
||||||
: Node(KVectorType, BaseType_->ParameterPackSize), BaseType(BaseType_),
|
: Node(KVectorType), BaseType(BaseType_),
|
||||||
Dimension(Dimension_), IsPixel(false) {
|
Dimension(Dimension_), IsPixel(false) {}
|
||||||
if (Dimension.isNode())
|
|
||||||
ParameterPackSize =
|
|
||||||
std::min(ParameterPackSize, Dimension.asNode()->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
if (IsPixel) {
|
if (IsPixel) {
|
||||||
@ -992,9 +948,17 @@ public:
|
|||||||
/// T_).
|
/// T_).
|
||||||
class ParameterPack final : public Node {
|
class ParameterPack final : public Node {
|
||||||
NodeArray Data;
|
NodeArray Data;
|
||||||
|
|
||||||
|
// Setup OutputStream for a pack expansion unless we're already expanding one.
|
||||||
|
void initializePackExpansion(OutputStream &S) const {
|
||||||
|
if (S.CurrentPackMax == std::numeric_limits<unsigned>::max()) {
|
||||||
|
S.CurrentPackMax = static_cast<unsigned>(Data.size());
|
||||||
|
S.CurrentPackIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ParameterPack(NodeArray Data_)
|
ParameterPack(NodeArray Data_) : Node(KParameterPack), Data(Data_) {
|
||||||
: Node(KParameterPack, static_cast<unsigned>(Data_.size())), Data(Data_) {
|
|
||||||
ArrayCache = FunctionCache = RHSComponentCache = Cache::Unknown;
|
ArrayCache = FunctionCache = RHSComponentCache = Cache::Unknown;
|
||||||
if (std::all_of(Data.begin(), Data.end(), [](Node* P) {
|
if (std::all_of(Data.begin(), Data.end(), [](Node* P) {
|
||||||
return P->ArrayCache == Cache::No;
|
return P->ArrayCache == Cache::No;
|
||||||
@ -1011,24 +975,29 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool hasRHSComponentSlow(OutputStream &S) const override {
|
bool hasRHSComponentSlow(OutputStream &S) const override {
|
||||||
|
initializePackExpansion(S);
|
||||||
size_t Idx = S.CurrentPackIndex;
|
size_t Idx = S.CurrentPackIndex;
|
||||||
return Idx < Data.size() && Data[Idx]->hasRHSComponent(S);
|
return Idx < Data.size() && Data[Idx]->hasRHSComponent(S);
|
||||||
}
|
}
|
||||||
bool hasArraySlow(OutputStream &S) const override {
|
bool hasArraySlow(OutputStream &S) const override {
|
||||||
|
initializePackExpansion(S);
|
||||||
size_t Idx = S.CurrentPackIndex;
|
size_t Idx = S.CurrentPackIndex;
|
||||||
return Idx < Data.size() && Data[Idx]->hasArray(S);
|
return Idx < Data.size() && Data[Idx]->hasArray(S);
|
||||||
}
|
}
|
||||||
bool hasFunctionSlow(OutputStream &S) const override {
|
bool hasFunctionSlow(OutputStream &S) const override {
|
||||||
|
initializePackExpansion(S);
|
||||||
size_t Idx = S.CurrentPackIndex;
|
size_t Idx = S.CurrentPackIndex;
|
||||||
return Idx < Data.size() && Data[Idx]->hasFunction(S);
|
return Idx < Data.size() && Data[Idx]->hasFunction(S);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
|
initializePackExpansion(S);
|
||||||
size_t Idx = S.CurrentPackIndex;
|
size_t Idx = S.CurrentPackIndex;
|
||||||
if (Idx < Data.size())
|
if (Idx < Data.size())
|
||||||
Data[Idx]->printLeft(S);
|
Data[Idx]->printLeft(S);
|
||||||
}
|
}
|
||||||
void printRight(OutputStream &S) const override {
|
void printRight(OutputStream &S) const override {
|
||||||
|
initializePackExpansion(S);
|
||||||
size_t Idx = S.CurrentPackIndex;
|
size_t Idx = S.CurrentPackIndex;
|
||||||
if (Idx < Data.size())
|
if (Idx < Data.size())
|
||||||
Data[Idx]->printRight(S);
|
Data[Idx]->printRight(S);
|
||||||
@ -1044,10 +1013,7 @@ class TemplateArgumentPack final : public Node {
|
|||||||
NodeArray Elements;
|
NodeArray Elements;
|
||||||
public:
|
public:
|
||||||
TemplateArgumentPack(NodeArray Elements_)
|
TemplateArgumentPack(NodeArray Elements_)
|
||||||
: Node(KTemplateArgumentPack), Elements(Elements_) {
|
: Node(KTemplateArgumentPack), Elements(Elements_) {}
|
||||||
for (Node *E : Elements)
|
|
||||||
ParameterPackSize = std::min(E->ParameterPackSize, ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeArray getElements() const { return Elements; }
|
NodeArray getElements() const { return Elements; }
|
||||||
|
|
||||||
@ -1068,60 +1034,49 @@ public:
|
|||||||
const Node *getChild() const { return Child; }
|
const Node *getChild() const { return Child; }
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
unsigned PackSize = Child->ParameterPackSize;
|
constexpr unsigned Max = std::numeric_limits<unsigned>::max();
|
||||||
if (PackSize == NoParameterPack) {
|
SwapAndRestore<unsigned> SavePackIdx(S.CurrentPackIndex, Max);
|
||||||
Child->print(S);
|
SwapAndRestore<unsigned> SavePackMax(S.CurrentPackMax, Max);
|
||||||
|
size_t StreamPos = S.getCurrentPosition();
|
||||||
|
|
||||||
|
// Print the first element in the pack. If Child contains a ParameterPack,
|
||||||
|
// it will set up S.CurrentPackMax and print the first element.
|
||||||
|
Child->print(S);
|
||||||
|
|
||||||
|
// No ParameterPack was found in Child. This can occur if we've found a pack
|
||||||
|
// expansion on a <function-param>.
|
||||||
|
if (S.CurrentPackMax == Max) {
|
||||||
S += "...";
|
S += "...";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SwapAndRestore<unsigned> SavePackIndex(S.CurrentPackIndex, 0);
|
// We found a ParameterPack, but it has no elements. Erase whatever we may
|
||||||
for (unsigned I = 0; I != PackSize; ++I) {
|
// of printed.
|
||||||
if (I != 0)
|
if (S.CurrentPackMax == 0) {
|
||||||
S += ", ";
|
S.setCurrentPosition(StreamPos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Else, iterate through the rest of the elements in the pack.
|
||||||
|
for (unsigned I = 1, E = S.CurrentPackMax; I < E; ++I) {
|
||||||
|
S += ", ";
|
||||||
S.CurrentPackIndex = I;
|
S.CurrentPackIndex = I;
|
||||||
Child->print(S);
|
Child->print(S);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool Node::isEmptyPackExpansion() const {
|
|
||||||
if (getKind() == KParameterPackExpansion) {
|
|
||||||
auto *AsPack = static_cast<const ParameterPackExpansion *>(this);
|
|
||||||
return AsPack->getChild()->isEmptyPackExpansion();
|
|
||||||
}
|
|
||||||
if (getKind() == KTemplateArgumentPack) {
|
|
||||||
auto *AsTemplateArg = static_cast<const TemplateArgumentPack *>(this);
|
|
||||||
for (Node *E : AsTemplateArg->getElements())
|
|
||||||
if (!E->isEmptyPackExpansion())
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return ParameterPackSize == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
class TemplateArgs final : public Node {
|
class TemplateArgs final : public Node {
|
||||||
NodeArray Params;
|
NodeArray Params;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TemplateArgs(NodeArray Params_) : Node(KTemplateArgs), Params(Params_) {
|
TemplateArgs(NodeArray Params_) : Node(KTemplateArgs), Params(Params_) {}
|
||||||
for (Node *P : Params)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, P->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeArray getParams() { return Params; }
|
NodeArray getParams() { return Params; }
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "<";
|
S += "<";
|
||||||
bool FirstElement = true;
|
Params.printWithComma(S);
|
||||||
for (size_t Idx = 0, E = Params.size(); Idx != E; ++Idx) {
|
|
||||||
if (Params[Idx]->isEmptyPackExpansion())
|
|
||||||
continue;
|
|
||||||
if (!FirstElement)
|
|
||||||
S += ", ";
|
|
||||||
FirstElement = false;
|
|
||||||
Params[Idx]->print(S);
|
|
||||||
}
|
|
||||||
if (S.back() == '>')
|
if (S.back() == '>')
|
||||||
S += " ";
|
S += " ";
|
||||||
S += ">";
|
S += ">";
|
||||||
@ -1135,9 +1090,7 @@ class NameWithTemplateArgs final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
NameWithTemplateArgs(Node *Name_, Node *TemplateArgs_)
|
NameWithTemplateArgs(Node *Name_, Node *TemplateArgs_)
|
||||||
: Node(KNameWithTemplateArgs, std::min(Name_->ParameterPackSize,
|
: Node(KNameWithTemplateArgs), Name(Name_), TemplateArgs(TemplateArgs_) {}
|
||||||
TemplateArgs_->ParameterPackSize)),
|
|
||||||
Name(Name_), TemplateArgs(TemplateArgs_) {}
|
|
||||||
|
|
||||||
StringView getBaseName() const override { return Name->getBaseName(); }
|
StringView getBaseName() const override { return Name->getBaseName(); }
|
||||||
|
|
||||||
@ -1152,7 +1105,7 @@ class GlobalQualifiedName final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
GlobalQualifiedName(Node* Child_)
|
GlobalQualifiedName(Node* Child_)
|
||||||
: Node(KGlobalQualifiedName, Child_->ParameterPackSize), Child(Child_) {}
|
: Node(KGlobalQualifiedName), Child(Child_) {}
|
||||||
|
|
||||||
StringView getBaseName() const override { return Child->getBaseName(); }
|
StringView getBaseName() const override { return Child->getBaseName(); }
|
||||||
|
|
||||||
@ -1166,8 +1119,7 @@ class StdQualifiedName final : public Node {
|
|||||||
Node *Child;
|
Node *Child;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StdQualifiedName(Node *Child_)
|
StdQualifiedName(Node *Child_) : Node(KStdQualifiedName), Child(Child_) {}
|
||||||
: Node(KStdQualifiedName, Child_->ParameterPackSize), Child(Child_) {}
|
|
||||||
|
|
||||||
StringView getBaseName() const override { return Child->getBaseName(); }
|
StringView getBaseName() const override { return Child->getBaseName(); }
|
||||||
|
|
||||||
@ -1290,8 +1242,7 @@ class CtorDtorName final : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CtorDtorName(Node *Basename_, bool IsDtor_)
|
CtorDtorName(Node *Basename_, bool IsDtor_)
|
||||||
: Node(KCtorDtorName, Basename_->ParameterPackSize),
|
: Node(KCtorDtorName), Basename(Basename_), IsDtor(IsDtor_) {}
|
||||||
Basename(Basename_), IsDtor(IsDtor_) {}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
if (IsDtor)
|
if (IsDtor)
|
||||||
@ -1304,9 +1255,7 @@ class DtorName : public Node {
|
|||||||
const Node *Base;
|
const Node *Base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DtorName(Node *Base_) : Node(KDtorName), Base(Base_) {
|
DtorName(Node *Base_) : Node(KDtorName), Base(Base_) {}
|
||||||
ParameterPackSize = Base->ParameterPackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "~";
|
S += "~";
|
||||||
@ -1333,10 +1282,7 @@ class ClosureTypeName : public Node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ClosureTypeName(NodeArray Params_, StringView Count_)
|
ClosureTypeName(NodeArray Params_, StringView Count_)
|
||||||
: Node(KClosureTypeName), Params(Params_), Count(Count_) {
|
: Node(KClosureTypeName), Params(Params_), Count(Count_) {}
|
||||||
for (Node *P : Params)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, P->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "\'lambda";
|
S += "\'lambda";
|
||||||
@ -1373,10 +1319,7 @@ class BinaryExpr : public Expr {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
BinaryExpr(Node *LHS_, StringView InfixOperator_, Node *RHS_)
|
BinaryExpr(Node *LHS_, StringView InfixOperator_, Node *RHS_)
|
||||||
: LHS(LHS_), InfixOperator(InfixOperator_), RHS(RHS_) {
|
: LHS(LHS_), InfixOperator(InfixOperator_), RHS(RHS_) {}
|
||||||
ParameterPackSize =
|
|
||||||
std::min(LHS->ParameterPackSize, RHS->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
// might be a template argument expression, then we need to disambiguate
|
// might be a template argument expression, then we need to disambiguate
|
||||||
@ -1402,10 +1345,7 @@ class ArraySubscriptExpr : public Expr {
|
|||||||
const Node *Op2;
|
const Node *Op2;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArraySubscriptExpr(Node *Op1_, Node *Op2_) : Op1(Op1_), Op2(Op2_) {
|
ArraySubscriptExpr(Node *Op1_, Node *Op2_) : Op1(Op1_), Op2(Op2_) {}
|
||||||
ParameterPackSize =
|
|
||||||
std::min(Op1->ParameterPackSize, Op2->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "(";
|
S += "(";
|
||||||
@ -1422,9 +1362,7 @@ class PostfixExpr : public Expr {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PostfixExpr(Node *Child_, StringView Operand_)
|
PostfixExpr(Node *Child_, StringView Operand_)
|
||||||
: Child(Child_), Operand(Operand_) {
|
: Child(Child_), Operand(Operand_) {}
|
||||||
ParameterPackSize = Child->ParameterPackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "(";
|
S += "(";
|
||||||
@ -1441,11 +1379,7 @@ class ConditionalExpr : public Expr {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ConditionalExpr(Node *Cond_, Node *Then_, Node *Else_)
|
ConditionalExpr(Node *Cond_, Node *Then_, Node *Else_)
|
||||||
: Cond(Cond_), Then(Then_), Else(Else_) {
|
: Cond(Cond_), Then(Then_), Else(Else_) {}
|
||||||
ParameterPackSize =
|
|
||||||
std::min(Cond->ParameterPackSize,
|
|
||||||
std::min(Then->ParameterPackSize, Else->ParameterPackSize));
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "(";
|
S += "(";
|
||||||
@ -1465,10 +1399,7 @@ class MemberExpr : public Expr {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
MemberExpr(Node *LHS_, StringView Kind_, Node *RHS_)
|
MemberExpr(Node *LHS_, StringView Kind_, Node *RHS_)
|
||||||
: LHS(LHS_), Kind(Kind_), RHS(RHS_) {
|
: LHS(LHS_), Kind(Kind_), RHS(RHS_) {}
|
||||||
ParameterPackSize =
|
|
||||||
std::min(LHS->ParameterPackSize, RHS->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
LHS->print(S);
|
LHS->print(S);
|
||||||
@ -1484,9 +1415,7 @@ class EnclosingExpr : public Expr {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
EnclosingExpr(StringView Prefix_, Node *Infix_, StringView Postfix_)
|
EnclosingExpr(StringView Prefix_, Node *Infix_, StringView Postfix_)
|
||||||
: Prefix(Prefix_), Infix(Infix_), Postfix(Postfix_) {
|
: Prefix(Prefix_), Infix(Infix_), Postfix(Postfix_) {}
|
||||||
ParameterPackSize = Infix->ParameterPackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += Prefix;
|
S += Prefix;
|
||||||
@ -1503,10 +1432,7 @@ class CastExpr : public Expr {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CastExpr(StringView CastKind_, Node *To_, Node *From_)
|
CastExpr(StringView CastKind_, Node *To_, Node *From_)
|
||||||
: CastKind(CastKind_), To(To_), From(From_) {
|
: CastKind(CastKind_), To(To_), From(From_) {}
|
||||||
ParameterPackSize =
|
|
||||||
std::min(To->ParameterPackSize, From->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += CastKind;
|
S += CastKind;
|
||||||
@ -1537,11 +1463,7 @@ class CallExpr : public Expr {
|
|||||||
NodeArray Args;
|
NodeArray Args;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CallExpr(Node *Callee_, NodeArray Args_) : Callee(Callee_), Args(Args_) {
|
CallExpr(Node *Callee_, NodeArray Args_) : Callee(Callee_), Args(Args_) {}
|
||||||
for (Node *P : Args)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, P->ParameterPackSize);
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, Callee->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
Callee->print(S);
|
Callee->print(S);
|
||||||
@ -1562,14 +1484,7 @@ public:
|
|||||||
NewExpr(NodeArray ExprList_, Node *Type_, NodeArray InitList_, bool IsGlobal_,
|
NewExpr(NodeArray ExprList_, Node *Type_, NodeArray InitList_, bool IsGlobal_,
|
||||||
bool IsArray_)
|
bool IsArray_)
|
||||||
: ExprList(ExprList_), Type(Type_), InitList(InitList_),
|
: ExprList(ExprList_), Type(Type_), InitList(InitList_),
|
||||||
IsGlobal(IsGlobal_), IsArray(IsArray_) {
|
IsGlobal(IsGlobal_), IsArray(IsArray_) {}
|
||||||
for (Node *E : ExprList)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, E->ParameterPackSize);
|
|
||||||
for (Node *I : InitList)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, I->ParameterPackSize);
|
|
||||||
if (Type)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, Type->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
if (IsGlobal)
|
if (IsGlobal)
|
||||||
@ -1600,9 +1515,7 @@ class DeleteExpr : public Expr {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DeleteExpr(Node *Op_, bool IsGlobal_, bool IsArray_)
|
DeleteExpr(Node *Op_, bool IsGlobal_, bool IsArray_)
|
||||||
: Op(Op_), IsGlobal(IsGlobal_), IsArray(IsArray_) {
|
: Op(Op_), IsGlobal(IsGlobal_), IsArray(IsArray_) {}
|
||||||
ParameterPackSize = Op->ParameterPackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
if (IsGlobal)
|
if (IsGlobal)
|
||||||
@ -1619,9 +1532,7 @@ class PrefixExpr : public Expr {
|
|||||||
Node *Child;
|
Node *Child;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PrefixExpr(StringView Prefix_, Node *Child_) : Prefix(Prefix_), Child(Child_) {
|
PrefixExpr(StringView Prefix_, Node *Child_) : Prefix(Prefix_), Child(Child_) {}
|
||||||
ParameterPackSize = Child->ParameterPackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += Prefix;
|
S += Prefix;
|
||||||
@ -1649,11 +1560,7 @@ class ConversionExpr : public Expr {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ConversionExpr(const Node *Type_, NodeArray Expressions_)
|
ConversionExpr(const Node *Type_, NodeArray Expressions_)
|
||||||
: Type(Type_), Expressions(Expressions_) {
|
: Type(Type_), Expressions(Expressions_) {}
|
||||||
for (Node *E : Expressions)
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, E->ParameterPackSize);
|
|
||||||
ParameterPackSize = std::min(ParameterPackSize, Type->ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "(";
|
S += "(";
|
||||||
@ -1668,13 +1575,7 @@ class InitListExpr : public Expr {
|
|||||||
Node *Ty;
|
Node *Ty;
|
||||||
NodeArray Inits;
|
NodeArray Inits;
|
||||||
public:
|
public:
|
||||||
InitListExpr(Node *Ty_, NodeArray Inits_)
|
InitListExpr(Node *Ty_, NodeArray Inits_) : Ty(Ty_), Inits(Inits_) {}
|
||||||
: Ty(Ty_), Inits(Inits_) {
|
|
||||||
if (Ty)
|
|
||||||
ParameterPackSize = Ty->ParameterPackSize;
|
|
||||||
for (Node *I : Inits)
|
|
||||||
ParameterPackSize = std::min(I->ParameterPackSize, ParameterPackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
if (Ty)
|
if (Ty)
|
||||||
@ -1732,9 +1633,7 @@ class ThrowExpr : public Expr {
|
|||||||
const Node *Op;
|
const Node *Op;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ThrowExpr(Node *Op_) : Op(Op_) {
|
ThrowExpr(Node *Op_) : Op(Op_) {}
|
||||||
ParameterPackSize = Op->ParameterPackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "throw ";
|
S += "throw ";
|
||||||
@ -1759,9 +1658,8 @@ class IntegerCastExpr : public Expr {
|
|||||||
StringView Integer;
|
StringView Integer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IntegerCastExpr(Node *Ty_, StringView Integer_) : Ty(Ty_), Integer(Integer_) {
|
IntegerCastExpr(Node *Ty_, StringView Integer_)
|
||||||
ParameterPackSize = Ty->ParameterPackSize;
|
: Ty(Ty_), Integer(Integer_) {}
|
||||||
}
|
|
||||||
|
|
||||||
void printLeft(OutputStream &S) const override {
|
void printLeft(OutputStream &S) const override {
|
||||||
S += "(";
|
S += "(";
|
||||||
@ -4896,9 +4794,6 @@ char *llvm::itaniumDemangle(const char *MangledName, char *Buf,
|
|||||||
InternalStatus = invalid_mangled_name;
|
InternalStatus = invalid_mangled_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InternalStatus == success && AST->containsUnexpandedParameterPack())
|
|
||||||
InternalStatus = invalid_mangled_name;
|
|
||||||
|
|
||||||
if (InternalStatus == success) {
|
if (InternalStatus == success) {
|
||||||
if (Buf == nullptr) {
|
if (Buf == nullptr) {
|
||||||
BufSize = 1024;
|
BufSize = 1024;
|
||||||
|
Loading…
Reference in New Issue
Block a user