Use ilist rather than std::list for Node and Edge lists in the PBQP graph. This

should fix an issue (described at http://stackoverflow.com/questions/10065384/instantiation-of-a-list-with-an-incomplete-type-in-a-typedef)
that was preventing LLVMCodeGen from building with libc++ in C++11 mode.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166484 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames 2012-10-23 17:10:51 +00:00
parent 92b0d8cf2c
commit 2d7581a542

View File

@ -19,6 +19,7 @@
#include <list> #include <list>
#include <map> #include <map>
#include <llvm/ADT/ilist.h>
namespace PBQP { namespace PBQP {
@ -31,16 +32,16 @@ namespace PBQP {
class NodeEntry; class NodeEntry;
class EdgeEntry; class EdgeEntry;
typedef std::list<NodeEntry> NodeList; typedef llvm::ilist<NodeEntry> NodeList;
typedef std::list<EdgeEntry> EdgeList; typedef llvm::ilist<EdgeEntry> EdgeList;
public: public:
typedef NodeList::iterator NodeItr; typedef NodeEntry* NodeItr;
typedef NodeList::const_iterator ConstNodeItr; typedef const NodeEntry* ConstNodeItr;
typedef EdgeList::iterator EdgeItr; typedef EdgeEntry* EdgeItr;
typedef EdgeList::const_iterator ConstEdgeItr; typedef const EdgeEntry* ConstEdgeItr;
private: private:
@ -52,12 +53,14 @@ namespace PBQP {
private: private:
class NodeEntry { class NodeEntry : public llvm::ilist_node<NodeEntry> {
friend struct llvm::ilist_sentinel_traits<NodeEntry>;
private: private:
Vector costs; Vector costs;
AdjEdgeList adjEdges; AdjEdgeList adjEdges;
unsigned degree; unsigned degree;
void *data; void *data;
NodeEntry() : costs(0, 0) {}
public: public:
NodeEntry(const Vector &costs) : costs(costs), degree(0) {} NodeEntry(const Vector &costs) : costs(costs), degree(0) {}
Vector& getCosts() { return costs; } Vector& getCosts() { return costs; }
@ -77,12 +80,14 @@ namespace PBQP {
void* getData() { return data; } void* getData() { return data; }
}; };
class EdgeEntry { class EdgeEntry : public llvm::ilist_node<EdgeEntry> {
friend struct llvm::ilist_sentinel_traits<EdgeEntry>;
private: private:
NodeItr node1, node2; NodeItr node1, node2;
Matrix costs; Matrix costs;
AdjEdgeItr node1AEItr, node2AEItr; AdjEdgeItr node1AEItr, node2AEItr;
void *data; void *data;
EdgeEntry() : costs(0, 0, 0) {}
public: public:
EdgeEntry(NodeItr node1, NodeItr node2, const Matrix &costs) EdgeEntry(NodeItr node1, NodeItr node2, const Matrix &costs)
: node1(node1), node2(node2), costs(costs) {} : node1(node1), node2(node2), costs(costs) {}