diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2018-08-26 09:17:49 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2018-08-26 09:17:49 +0000 |
commit | d38d9505d1bf380a67bccc6f5a29019394c1fd43 (patch) | |
tree | ce3f219b75a4526527aa4016e3f71f83bad861e6 /llvm/lib/Support/ItaniumManglingCanonicalizer.cpp | |
parent | 698fbe7b59a77888f108fbfe37e17a1db0cace8c (diff) | |
download | bcm5719-llvm-d38d9505d1bf380a67bccc6f5a29019394c1fd43.tar.gz bcm5719-llvm-d38d9505d1bf380a67bccc6f5a29019394c1fd43.zip |
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
Diffstat (limited to 'llvm/lib/Support/ItaniumManglingCanonicalizer.cpp')
-rw-r--r-- | llvm/lib/Support/ItaniumManglingCanonicalizer.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp b/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp index 7023305774e..ca63c6d1c7d 100644 --- a/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp +++ b/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp @@ -104,8 +104,19 @@ class FoldingNodeAllocator { public: void reset() {} - template<typename T, typename ...Args> - std::pair<Node*, bool> getOrCreateNode(bool CreateNewNodes, Args &&...As) { + template <typename T, typename... Args> + 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; 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 { Node *MostRecentlyCreated = nullptr; Node *TrackedNode = nullptr; |