From 3362c5fb0fcff70a52e606b7a57754aba5f9a3a9 Mon Sep 17 00:00:00 2001 From: Pavel Chupin Date: Mon, 14 Jul 2014 09:58:10 +0000 Subject: [x32] Add __ILP32__ macro for ILP32 platforms Summary: Add __ILP32__ and _ILP32 macro for corresponding platforms. Cover x86_64-*-*-gnux32 with test. Test Plan: test added Reviewers: chandlerc, atanasyan Subscribers: cfe-commits, dschuff, zinovy.nis Differential Revision: http://reviews.llvm.org/D4473 llvm-svn: 212931 --- clang/lib/Frontend/InitPreprocessor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/Frontend/InitPreprocessor.cpp') diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 1ce4279df91..e026de21232 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -595,6 +595,12 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__LP64__"); } + if (TI.getPointerWidth(0) == 32 && TI.getLongWidth() == 32 + && TI.getIntWidth() == 32) { + Builder.defineMacro("_ILP32"); + Builder.defineMacro("__ILP32__"); + } + // Define type sizing macros based on the target properties. assert(TI.getCharWidth() == 8 && "Only support 8-bit char so far"); Builder.defineMacro("__CHAR_BIT__", "8"); -- cgit v1.2.3