summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/clang/lib/CodeGen/CGBlocks.h
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/tools/clang/lib/CodeGen/CGBlocks.h')
-rw-r--r--gnu/llvm/tools/clang/lib/CodeGen/CGBlocks.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/gnu/llvm/tools/clang/lib/CodeGen/CGBlocks.h b/gnu/llvm/tools/clang/lib/CodeGen/CGBlocks.h
index 80e255f7541..5abf82b3f6e 100644
--- a/gnu/llvm/tools/clang/lib/CodeGen/CGBlocks.h
+++ b/gnu/llvm/tools/clang/lib/CodeGen/CGBlocks.h
@@ -54,6 +54,7 @@ enum BlockByrefFlags {
};
enum BlockLiteralFlags {
+ BLOCK_IS_NOESCAPE = (1 << 23),
BLOCK_HAS_COPY_DISPOSE = (1 << 25),
BLOCK_HAS_CXX_OBJ = (1 << 26),
BLOCK_IS_GLOBAL = (1 << 28),
@@ -69,7 +70,7 @@ public:
BlockFlags() : flags(0) {}
BlockFlags(BlockLiteralFlags flag) : flags(flag) {}
BlockFlags(BlockByrefFlags flag) : flags(flag) {}
-
+
uint32_t getBitMask() const { return flags; }
bool empty() const { return flags == 0; }
@@ -207,14 +208,15 @@ public:
Capture v;
v.Data = reinterpret_cast<uintptr_t>(value);
return v;
- }
+ }
};
/// CanBeGlobal - True if the block can be global, i.e. it has
/// no non-constant captures.
bool CanBeGlobal : 1;
- /// True if the block needs a custom copy or dispose function.
+ /// True if the block has captures that would necessitate custom copy or
+ /// dispose helper functions if the block were escaping.
bool NeedsCopyDispose : 1;
/// HasCXXObject - True if the block's custom copy/dispose functions
@@ -224,13 +226,13 @@ public:
/// UsesStret : True if the block uses an stret return. Mutable
/// because it gets set later in the block-creation process.
mutable bool UsesStret : 1;
-
+
/// HasCapturedVariableLayout : True if block has captured variables
/// and their layout meta-data has been generated.
bool HasCapturedVariableLayout : 1;
/// The mapping of allocated indexes within the block.
- llvm::DenseMap<const VarDecl*, Capture> Captures;
+ llvm::DenseMap<const VarDecl*, Capture> Captures;
Address LocalAddress;
llvm::StructType *StructureType;
@@ -239,7 +241,7 @@ public:
CharUnits BlockSize;
CharUnits BlockAlign;
CharUnits CXXThisOffset;
-
+
// Offset of the gap caused by block header having a smaller
// alignment than the alignment of the block descriptor. This
// is the gap offset before the first capturued field.
@@ -276,6 +278,11 @@ public:
}
CGBlockInfo(const BlockDecl *blockDecl, StringRef Name);
+
+ // Indicates whether the block needs a custom copy or dispose function.
+ bool needsCopyDisposeHelpers() const {
+ return NeedsCopyDispose && !Block->doesNotEscape();
+ }
};
} // end namespace CodeGen