diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-29 02:14:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-29 02:14:09 +0000 |
commit | cafe9bba32aeed16e8e3db28b4cd4ff13160438f (patch) | |
tree | bfb7c4d1f2a2bf144d5525b22380806b86325c00 /include/llvm/BasicBlock.h | |
parent | 3990b121cf4a0b280ed3e54cf13870cbf4259e78 (diff) |
add a layer of accessors around the Value::SubClassData member, and use
a convention (shadowing the setter with private forwarding function) to
prevent subclasses from accidentally using it.
This exposed some bogosity in ConstantExprs, which was propaging the
opcode of the constant expr into the NUW/NSW/Exact field in the
getWithOperands/getWithOperandReplaced methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92239 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/BasicBlock.h')
-rw-r--r-- | include/llvm/BasicBlock.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h index 80d8702723..1add14402b 100644 --- a/include/llvm/BasicBlock.h +++ b/include/llvm/BasicBlock.h @@ -239,15 +239,21 @@ public: /// hasAddressTaken - returns true if there are any uses of this basic block /// other than direct branches, switches, etc. to it. - bool hasAddressTaken() const { return SubclassData != 0; } + bool hasAddressTaken() const { return getSubclassDataFromValue() != 0; } private: /// AdjustBlockAddressRefCount - BasicBlock stores the number of BlockAddress /// objects using it. This is almost always 0, sometimes one, possibly but /// almost never 2, and inconceivably 3 or more. void AdjustBlockAddressRefCount(int Amt) { - SubclassData += Amt; - assert((int)(signed char)SubclassData >= 0 && "Refcount wrap-around"); + setValueSubclassData(getSubclassDataFromValue()+Amt); + assert((int)(signed char)getSubclassDataFromValue() >= 0 && + "Refcount wrap-around"); + } + // Shadow Value::setValueSubclassData with a private forwarding method so that + // any future subclasses cannot accidentally use it. + void setValueSubclassData(unsigned short D) { + Value::setValueSubclassData(D); } }; |