forked from OSchip/llvm-project
parent
47c7bf0d26
commit
e41be48a59
|
|
@ -35,14 +35,13 @@ template<> struct ilist_traits<Instruction>
|
||||||
/// The sentinel is relative to this instance, so we use a non-static
|
/// The sentinel is relative to this instance, so we use a non-static
|
||||||
/// method.
|
/// method.
|
||||||
Instruction *createSentinel() const {
|
Instruction *createSentinel() const {
|
||||||
// since i(p)lists always publicly derive from the corresponding
|
// Since i(p)lists always publicly derive from their corresponding traits,
|
||||||
// traits, placing a data member in this class will augment i(p)list.
|
// placing a data member in this class will augment the i(p)list. But since
|
||||||
// But since the NodeTy is expected to publicly derive from
|
// the NodeTy is expected to be publicly derive from ilist_node<NodeTy>,
|
||||||
// ilist_node<NodeTy>, there is a legal viable downcast from it
|
// there is a legal viable downcast from it to NodeTy. We use this trick to
|
||||||
// to NodeTy. We use this trick to superpose i(p)list with a "ghostly"
|
// superimpose an i(p)list with a "ghostly" NodeTy, which becomes the
|
||||||
// NodeTy, which becomes the sentinel. Dereferencing the sentinel is
|
// sentinel. Dereferencing the sentinel is forbidden (save the
|
||||||
// forbidden (save the ilist_node<NodeTy>) so no one will ever notice
|
// ilist_node<NodeTy>), so no one will ever notice the superposition.
|
||||||
// the superposition.
|
|
||||||
return static_cast<Instruction*>(&Sentinel);
|
return static_cast<Instruction*>(&Sentinel);
|
||||||
}
|
}
|
||||||
static void destroySentinel(Instruction*) {}
|
static void destroySentinel(Instruction*) {}
|
||||||
|
|
@ -292,8 +291,8 @@ private:
|
||||||
assert((int)(signed char)getSubclassDataFromValue() >= 0 &&
|
assert((int)(signed char)getSubclassDataFromValue() >= 0 &&
|
||||||
"Refcount wrap-around");
|
"Refcount wrap-around");
|
||||||
}
|
}
|
||||||
// \brief Shadow Value::setValueSubclassData with a private forwarding method
|
/// \brief Shadow Value::setValueSubclassData with a private forwarding method
|
||||||
// so that any future subclasses cannot accidentally use it.
|
/// so that any future subclasses cannot accidentally use it.
|
||||||
void setValueSubclassData(unsigned short D) {
|
void setValueSubclassData(unsigned short D) {
|
||||||
Value::setValueSubclassData(D);
|
Value::setValueSubclassData(D);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue