summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenTBAA.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenTBAA.h')
-rw-r--r--clang/lib/CodeGen/CodeGenTBAA.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenTBAA.h b/clang/lib/CodeGen/CodeGenTBAA.h
index a5b1f66bcd1..7b3473fe63f 100644
--- a/clang/lib/CodeGen/CodeGenTBAA.h
+++ b/clang/lib/CodeGen/CodeGenTBAA.h
@@ -34,9 +34,10 @@ class CGRecordLayout;
// TBAAAccessKind - A kind of TBAA memory access descriptor.
enum class TBAAAccessKind : unsigned {
- Ordinary,
- MayAlias,
- Incomplete,
+ Ordinary, // An ordinary memory access.
+ MayAlias, // An access that may alias with any other accesses.
+ Incomplete, // Used to designate pointee values of incomplete types.
+ UnionMember, // An access to a direct or indirect union member.
};
// TBAAAccessInfo - Describes a memory access in terms of TBAA.
@@ -77,6 +78,14 @@ struct TBAAAccessInfo {
bool isIncomplete() const { return Kind == TBAAAccessKind::Incomplete; }
+ static TBAAAccessInfo getUnionMemberInfo(llvm::MDNode *BaseType,
+ uint64_t Offset, uint64_t Size) {
+ return TBAAAccessInfo(TBAAAccessKind::UnionMember, BaseType,
+ /* AccessType= */ nullptr, Offset, Size);
+ }
+
+ bool isUnionMember() const { return Kind == TBAAAccessKind::UnionMember; }
+
bool operator==(const TBAAAccessInfo &Other) const {
return Kind == Other.Kind &&
BaseType == Other.BaseType &&
@@ -148,6 +157,10 @@ class CodeGenTBAA {
/// considered to be equivalent to it.
llvm::MDNode *getChar();
+ /// getUnionMemberType - Get metadata that represents the type of union
+ /// members.
+ llvm::MDNode *getUnionMemberType(uint64_t Size);
+
/// CollectFields - Collect information about the fields of a type for
/// !tbaa.struct metadata formation. Return false for an unsupported type.
bool CollectFields(uint64_t BaseOffset,
OpenPOWER on IntegriCloud