aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Function.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-29 02:14:09 +0000
committerChris Lattner <sabre@nondot.org>2009-12-29 02:14:09 +0000
commitcafe9bba32aeed16e8e3db28b4cd4ff13160438f (patch)
treebfb7c4d1f2a2bf144d5525b22380806b86325c00 /include/llvm/Function.h
parent3990b121cf4a0b280ed3e54cf13870cbf4259e78 (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/Function.h')
-rw-r--r--include/llvm/Function.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 64be545ba4..38822332c4 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -87,6 +87,9 @@ private:
ValueSymbolTable *SymTab; ///< Symbol table of args/instructions
AttrListPtr AttributeList; ///< Parameter attributes
+ // HasLazyArguments is stored in Value::SubclassData.
+ /*bool HasLazyArguments;*/
+
// The Calling Convention is stored in Value::SubclassData.
/*CallingConv::ID CallingConvention;*/
@@ -99,7 +102,7 @@ private:
/// needs it. The hasLazyArguments predicate returns true if the arg list
/// hasn't been set up yet.
bool hasLazyArguments() const {
- return SubclassData & 1;
+ return getSubclassDataFromValue() & 1;
}
void CheckLazyArguments() const {
if (hasLazyArguments())
@@ -156,10 +159,11 @@ public:
/// calling convention of this function. The enum values for the known
/// calling conventions are defined in CallingConv.h.
CallingConv::ID getCallingConv() const {
- return static_cast<CallingConv::ID>(SubclassData >> 1);
+ return static_cast<CallingConv::ID>(getSubclassDataFromValue() >> 1);
}
void setCallingConv(CallingConv::ID CC) {
- SubclassData = (SubclassData & 1) | (static_cast<unsigned>(CC) << 1);
+ setValueSubclassData((getSubclassDataFromValue() & 1) |
+ (static_cast<unsigned>(CC) << 1));
}
/// getAttributes - Return the attribute list for this Function.
@@ -407,6 +411,12 @@ public:
/// hasAddressTaken - returns true if there are any uses of this function
/// other than direct calls or invokes to it.
bool hasAddressTaken() const;
+private:
+ // Shadow Value::setValueSubclassData with a private forwarding method so that
+ // subclasses cannot accidentally use it.
+ void setValueSubclassData(unsigned short D) {
+ Value::setValueSubclassData(D);
+ }
};
inline ValueSymbolTable *