mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-06 04:09:04 +00:00
Avoid specializing a variadic member template in a way that seems to not
agree with MSVC. There isn't actually a need for specialization here as we can write the code generically and just have a test that will fold away as a constant. llvm-svn: 340700
This commit is contained in:
parent
21e081b532
commit
060f1d33e8
@ -104,8 +104,19 @@ class FoldingNodeAllocator {
|
|||||||
public:
|
public:
|
||||||
void reset() {}
|
void reset() {}
|
||||||
|
|
||||||
template<typename T, typename ...Args>
|
template <typename T, typename... Args>
|
||||||
std::pair<Node*, bool> getOrCreateNode(bool CreateNewNodes, Args &&...As) {
|
std::pair<Node *, bool> getOrCreateNode(bool CreateNewNodes, Args &&... As) {
|
||||||
|
// FIXME: Don't canonicalize forward template references for now, because
|
||||||
|
// they contain state (the resolved template node) that's not known at their
|
||||||
|
// point of creation.
|
||||||
|
if (std::is_same<T, ForwardTemplateReference>::value) {
|
||||||
|
// Note that we don't use if-constexpr here and so we must still write
|
||||||
|
// this code in a generic form.
|
||||||
|
return {new (RawAlloc.Allocate(sizeof(T), alignof(T)))
|
||||||
|
T(std::forward<Args>(As)...),
|
||||||
|
true};
|
||||||
|
}
|
||||||
|
|
||||||
llvm::FoldingSetNodeID ID;
|
llvm::FoldingSetNodeID ID;
|
||||||
profileCtor(ID, NodeKind<T>::Kind, As...);
|
profileCtor(ID, NodeKind<T>::Kind, As...);
|
||||||
|
|
||||||
@ -136,19 +147,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: Don't canonicalize forward template references for now, because they
|
|
||||||
// contain state (the resolved template node) that's not known at their point
|
|
||||||
// of creation.
|
|
||||||
template<>
|
|
||||||
std::pair<Node *, bool>
|
|
||||||
FoldingNodeAllocator::getOrCreateNode<ForwardTemplateReference>(bool,
|
|
||||||
size_t &Index) {
|
|
||||||
return {new (RawAlloc.Allocate(sizeof(ForwardTemplateReference),
|
|
||||||
alignof(ForwardTemplateReference)))
|
|
||||||
ForwardTemplateReference(Index),
|
|
||||||
true};
|
|
||||||
}
|
|
||||||
|
|
||||||
class CanonicalizerAllocator : public FoldingNodeAllocator {
|
class CanonicalizerAllocator : public FoldingNodeAllocator {
|
||||||
Node *MostRecentlyCreated = nullptr;
|
Node *MostRecentlyCreated = nullptr;
|
||||||
Node *TrackedNode = nullptr;
|
Node *TrackedNode = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user