r316046 - Basic: fix __{,U}INTPTR_TYPE__ on ARM

Friedman, Eli via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 20 11:56:06 PDT 2017


On 10/17/2017 5:00 PM, Saleem Abdulrasool via cfe-commits wrote:
> Author: compnerd
> Date: Tue Oct 17 17:00:50 2017
> New Revision: 316046
>
> URL: http://llvm.org/viewvc/llvm-project?rev=316046&view=rev
> Log:
> Basic: fix __{,U}INTPTR_TYPE__ on ARM
>
> Darwin and OpenBSD are the only platforms which use `long int` for
> `__INTPTR_TYPE__`.  The other platforms use `int` in 32-bit, and `long
> int` on 64-bit (except for VMS and Windows which are LLP64).  Adjust the
> type definitions to match the platform definitions.  We now generate the
> same definition as GCC on all the targets.
>
> Modified:
>      cfe/trunk/lib/Basic/Targets/ARM.cpp
>      cfe/trunk/test/Preprocessor/init.c
>      cfe/trunk/test/Preprocessor/stdint.c
>
> Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=316046&r1=316045&r2=316046&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets/ARM.cpp Tue Oct 17 17:00:50 2017
> @@ -236,6 +236,10 @@ ARMTargetInfo::ARMTargetInfo(const llvm:
>       break;
>     }
>   
> +  IntPtrType = (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD)
> +                   ? SignedLong
> +                   : SignedInt;
> +
>     // Cache arch related info.
>     setArchInfo();
>   
> @@ -923,7 +927,6 @@ WindowsARMTargetInfo::WindowsARMTargetIn
>                                              const TargetOptions &Opts)
>       : WindowsTargetInfo<ARMleTargetInfo>(Triple, Opts), Triple(Triple) {
>     SizeType = UnsignedInt;
> -  IntPtrType = SignedInt;
>   }
>   

Generally, PtrDiffType, IntPtrType, and SizeType are all the same 
(ignoring signedness).  Please change the code to set all of these 
together.  With the code scattered like this, it isn't obvious your 
changes are consistent.  (Actually, I'm pretty sure they aren't consistent.)

Also, in the future, please don't commit any change which affects ABI 
definitions without pre-commit review; this is a tricky area, even if a 
change seems simple.

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the cfe-commits mailing list