From 1f6efa3996dd1929fbc129203ce5009b620e6969 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Mon, 29 Nov 2010 18:16:10 +0000 Subject: Merge System into Support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/ObjectFile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/llvm/Object/ObjectFile.h') diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h index ca51581..b47dc69 100644 --- a/include/llvm/Object/ObjectFile.h +++ b/include/llvm/Object/ObjectFile.h @@ -15,7 +15,7 @@ #define LLVM_OBJECT_OBJECT_FILE_H #include "llvm/ADT/StringRef.h" -#include "llvm/System/DataTypes.h" +#include "llvm/Support/DataTypes.h" namespace llvm { -- cgit v1.1 From 7acdb4d237181976b04e72f6a6c329c3b2604440 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Fri, 21 Jan 2011 02:27:02 +0000 Subject: Object: Fix type punned pointer issues by making DataRefImpl a union and using intptr_t. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123962 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/ObjectFile.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include/llvm/Object/ObjectFile.h') diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h index b47dc69..eee9d44 100644 --- a/include/llvm/Object/ObjectFile.h +++ b/include/llvm/Object/ObjectFile.h @@ -16,6 +16,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" +#include namespace llvm { @@ -25,7 +26,19 @@ class StringRef; namespace object { class ObjectFile; -typedef uint64_t DataRefImpl; + +union DataRefImpl { + struct { + uint32_t a, b; + } d; + intptr_t p; +}; + +static bool operator ==(const DataRefImpl &a, const DataRefImpl &b) { + // Check bitwise identical. This is the only legal way to compare a union w/o + // knowing which member is in use. + return std::memcmp(&a, &b, sizeof(DataRefImpl)) == 0; +} /// SymbolRef - This is a value type class that represents a single symbol in /// the list of symbols in the object file. -- cgit v1.1