From 83a7258ae40a52b00992b4baa83ef0e415997447 Mon Sep 17 00:00:00 2001 From: kai Date: Sat, 20 Oct 2012 17:49:58 +0200 Subject: [PATCH] Add address space number to getPointerSize() calls. This is required for LLVM 3.2. --- driver/main.cpp | 2 +- gen/llvmcompat.h | 2 ++ ir/ir.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/driver/main.cpp b/driver/main.cpp index 15ddb5e0..133bb057 100644 --- a/driver/main.cpp +++ b/driver/main.cpp @@ -581,7 +581,7 @@ int main(int argc, char** argv) global.params.isLE = gDataLayout->isLittleEndian(); // Starting with LLVM 3.1 we could also use global.params.targetTriple.isArch64Bit(); - global.params.is64bit = gDataLayout->getPointerSizeInBits() == 64; + global.params.is64bit = gDataLayout->getPointerSizeInBits(ADDRESS_SPACE) == 64; global.params.cpu = static_cast(global.params.targetTriple.getArch()); global.params.os = static_cast(global.params.targetTriple.getOS()); diff --git a/gen/llvmcompat.h b/gen/llvmcompat.h index 189a4b25..161168c6 100644 --- a/gen/llvmcompat.h +++ b/gen/llvmcompat.h @@ -31,8 +31,10 @@ namespace llvm { #endif #if LDC_LLVM_VER >= 302 +#define ADDRESS_SPACE 0 #define HAS_ATTRIBUTES(x) (x).hasAttributes() #else +#define ADDRESS_SPACE #define HAS_ATTRIBUTES(x) (x) #endif diff --git a/ir/ir.cpp b/ir/ir.cpp index 7c4d3f90..339b1a23 100644 --- a/ir/ir.cpp +++ b/ir/ir.cpp @@ -19,7 +19,7 @@ unsigned GetTypeAlignment(Ir* ir, Type* t) unsigned GetPointerSize(Ir* ir) { - return gDataLayout->getPointerSize(); + return gDataLayout->getPointerSize(ADDRESS_SPACE); } unsigned GetTypeStoreSize(Ir* ir, Type* t)