diff options
author | John McCall <rjmccall@apple.com> | 2013-03-13 03:10:54 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2013-03-13 03:10:54 +0000 |
commit | cdda29c968bdd78d5ac1be9fed0756028e557d08 (patch) | |
tree | 2575edea77c427c6232a24374bce79e06024e5a1 /clang/lib/CodeGen/CGValue.h | |
parent | 0c61dee1b929d1cdf69edfadbae57bd4862b6259 (diff) | |
download | bcm5719-llvm-cdda29c968bdd78d5ac1be9fed0756028e557d08.tar.gz bcm5719-llvm-cdda29c968bdd78d5ac1be9fed0756028e557d08.zip |
Tighten up the rules for precise lifetime and document
the requirements on the ARC optimizer.
rdar://13407451
llvm-svn: 176924
Diffstat (limited to 'clang/lib/CodeGen/CGValue.h')
-rw-r--r-- | clang/lib/CodeGen/CGValue.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGValue.h b/clang/lib/CodeGen/CGValue.h index 6b0c271a08a..b7591a76fb4 100644 --- a/clang/lib/CodeGen/CGValue.h +++ b/clang/lib/CodeGen/CGValue.h @@ -97,6 +97,10 @@ public: } }; +/// Does an ARC strong l-value have precise lifetime? +enum ARCPreciseLifetime_t { + ARCImpreciseLifetime, ARCPreciseLifetime, +}; /// LValue - This represents an lvalue references. Because C/C++ allow /// bitfields, this is not a simple LLVM pointer, it may be a pointer plus a @@ -147,6 +151,10 @@ class LValue { // Lvalue is a thread local reference bool ThreadLocalRef : 1; + // Lvalue has ARC imprecise lifetime. We store this inverted to try + // to make the default bitfield pattern all-zeroes. + bool ImpreciseLifetime : 1; + Expr *BaseIvarExp; /// TBAAInfo - TBAA information to attach to dereferences of this LValue. @@ -164,6 +172,7 @@ private: // Initialize Objective-C flags. this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef = false; + this->ImpreciseLifetime = false; this->ThreadLocalRef = false; this->BaseIvarExp = 0; this->TBAAInfo = TBAAInfo; @@ -202,6 +211,13 @@ public: bool isThreadLocalRef() const { return ThreadLocalRef; } void setThreadLocalRef(bool Value) { ThreadLocalRef = Value;} + ARCPreciseLifetime_t isARCPreciseLifetime() const { + return ARCPreciseLifetime_t(!ImpreciseLifetime); + } + void setARCPreciseLifetime(ARCPreciseLifetime_t value) { + ImpreciseLifetime = (value == ARCImpreciseLifetime); + } + bool isObjCWeak() const { return Quals.getObjCGCAttr() == Qualifiers::Weak; } |