-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux-offsetof.patch
22 lines (20 loc) · 1.04 KB
/
linux-offsetof.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- include/llvm/Support/Allocator.h.orig 2018-04-04 12:50:36.000000000 -0400
+++ include/llvm/Support/Allocator.h 2018-04-04 12:50:59.000000000 -0400
@@ -22,6 +22,8 @@
#include <cstddef>
#include <cstdlib>
+#define offsetof(t, d) __builtin_offsetof(t, d)
+
namespace llvm {
template <typename T> struct ReferenceAdder { typedef T& result; };
template <typename T> struct ReferenceAdder<T&> { typedef T result; };
--- tools/clang/lib/Rewrite/Core/RewriteRope.cpp.orig 2018-04-04 21:01:57.000000000 -0400
+++ tools/clang/lib/Rewrite/Core/RewriteRope.cpp 2018-04-04 21:02:57.000000000 -0400
@@ -792,7 +792,7 @@ RopePiece RewriteRope::MakeRopeString(co
if (AllocBuffer && --AllocBuffer->RefCount == 0)
delete [] (char*)AllocBuffer;
- unsigned AllocSize = offsetof(RopeRefCountString, Data) + AllocChunkSize;
+ unsigned AllocSize = __builtin_offsetof(RopeRefCountString, Data) + AllocChunkSize;
AllocBuffer = reinterpret_cast<RopeRefCountString *>(new char[AllocSize]);
AllocBuffer->RefCount = 0;
memcpy(AllocBuffer->Data, Start, Len);