r213065 - Make sure int64_t and uint64_t are consistent.
Joerg Sonnenberger
joerg at bec.de
Tue Jul 15 04:51:40 PDT 2014
Author: joerg
Date: Tue Jul 15 06:51:38 2014
New Revision: 213065
URL: http://llvm.org/viewvc/llvm-project?rev=213065&view=rev
Log:
Make sure int64_t and uint64_t are consistent.
Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/Preprocessor/init.c
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=213065&r1=213064&r2=213065&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Jul 15 06:51:38 2014
@@ -221,6 +221,9 @@ public:
IntType getChar16Type() const { return Char16Type; }
IntType getChar32Type() const { return Char32Type; }
IntType getInt64Type() const { return Int64Type; }
+ IntType getUInt64Type() const {
+ return getCorrespondingUnsignedType(Int64Type);
+ }
IntType getSigAtomicType() const { return SigAtomicType; }
IntType getProcessIDType() const { return ProcessIDType; }
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=213065&r1=213064&r2=213065&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Tue Jul 15 06:51:38 2014
@@ -232,7 +232,7 @@ static void DefineExactWidthIntType(Targ
// Use the target specified int64 type, when appropriate, so that [u]int64_t
// ends up being defined in terms of the correct type.
if (TypeWidth == 64)
- Ty = IsSigned ? TI.getInt64Type() : TI.getIntTypeByWidth(64, false);
+ Ty = IsSigned ? TI.getInt64Type() : TI.getUInt64Type();
const char *Prefix = IsSigned ? "__INT" : "__UINT";
@@ -254,7 +254,7 @@ static void DefineExactWidthIntTypeSize(
// Use the target specified int64 type, when appropriate, so that [u]int64_t
// ends up being defined in terms of the correct type.
if (TypeWidth == 64)
- Ty = IsSigned ? TI.getInt64Type() : TI.getIntTypeByWidth(64, false);
+ Ty = IsSigned ? TI.getInt64Type() : TI.getUInt64Type();
const char *Prefix = IsSigned ? "__INT" : "__UINT";
DefineTypeSize(Prefix + Twine(TypeWidth) + "_MAX__", Ty, TI, Builder);
Modified: cfe/trunk/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=213065&r1=213064&r2=213065&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Jul 15 06:51:38 2014
@@ -749,9 +749,9 @@
// AARCH64-NETBSD:#define __UINT32_C_SUFFIX__ U
// AARCH64-NETBSD:#define __UINT32_MAX__ 4294967295U
// AARCH64-NETBSD:#define __UINT32_TYPE__ unsigned int
-// AARCH64-NETBSD:#define __UINT64_C_SUFFIX__ UL
-// AARCH64-NETBSD:#define __UINT64_MAX__ 18446744073709551615UL
-// AARCH64-NETBSD:#define __UINT64_TYPE__ long unsigned int
+// AARCH64-NETBSD:#define __UINT64_C_SUFFIX__ ULL
+// AARCH64-NETBSD:#define __UINT64_MAX__ 18446744073709551615ULL
+// AARCH64-NETBSD:#define __UINT64_TYPE__ long long unsigned int
// AARCH64-NETBSD:#define __UINT8_C_SUFFIX__ U
// AARCH64-NETBSD:#define __UINT8_MAX__ 255U
// AARCH64-NETBSD:#define __UINT8_TYPE__ unsigned char
@@ -2881,9 +2881,9 @@
// MIPS64BE:#define __UINT32_C_SUFFIX__ U
// MIPS64BE:#define __UINT32_MAX__ 4294967295U
// MIPS64BE:#define __UINT32_TYPE__ unsigned int
-// MIPS64BE:#define __UINT64_C_SUFFIX__ UL
-// MIPS64BE:#define __UINT64_MAX__ 18446744073709551615UL
-// MIPS64BE:#define __UINT64_TYPE__ long unsigned int
+// MIPS64BE:#define __UINT64_C_SUFFIX__ ULL
+// MIPS64BE:#define __UINT64_MAX__ 18446744073709551615ULL
+// MIPS64BE:#define __UINT64_TYPE__ long long unsigned int
// MIPS64BE:#define __UINT8_C_SUFFIX__ U
// MIPS64BE:#define __UINT8_MAX__ 255U
// MIPS64BE:#define __UINT8_TYPE__ unsigned char
@@ -3082,9 +3082,9 @@
// MIPS64EL:#define __UINT32_C_SUFFIX__ U
// MIPS64EL:#define __UINT32_MAX__ 4294967295U
// MIPS64EL:#define __UINT32_TYPE__ unsigned int
-// MIPS64EL:#define __UINT64_C_SUFFIX__ UL
-// MIPS64EL:#define __UINT64_MAX__ 18446744073709551615UL
-// MIPS64EL:#define __UINT64_TYPE__ long unsigned int
+// MIPS64EL:#define __UINT64_C_SUFFIX__ ULL
+// MIPS64EL:#define __UINT64_MAX__ 18446744073709551615ULL
+// MIPS64EL:#define __UINT64_TYPE__ long long unsigned int
// MIPS64EL:#define __UINT8_C_SUFFIX__ U
// MIPS64EL:#define __UINT8_MAX__ 255U
// MIPS64EL:#define __UINT8_TYPE__ unsigned char
@@ -3618,9 +3618,9 @@
// NVPTX32:#define __UINT32_C_SUFFIX__ U
// NVPTX32:#define __UINT32_MAX__ 4294967295U
// NVPTX32:#define __UINT32_TYPE__ unsigned int
-// NVPTX32:#define __UINT64_C_SUFFIX__ UL
-// NVPTX32:#define __UINT64_MAX__ 18446744073709551615UL
-// NVPTX32:#define __UINT64_TYPE__ long unsigned int
+// NVPTX32:#define __UINT64_C_SUFFIX__ ULL
+// NVPTX32:#define __UINT64_MAX__ 18446744073709551615ULL
+// NVPTX32:#define __UINT64_TYPE__ long long unsigned int
// NVPTX32:#define __UINT8_C_SUFFIX__ U
// NVPTX32:#define __UINT8_MAX__ 255U
// NVPTX32:#define __UINT8_TYPE__ unsigned char
@@ -3798,9 +3798,9 @@
// NVPTX64:#define __UINT32_C_SUFFIX__ U
// NVPTX64:#define __UINT32_MAX__ 4294967295U
// NVPTX64:#define __UINT32_TYPE__ unsigned int
-// NVPTX64:#define __UINT64_C_SUFFIX__ UL
-// NVPTX64:#define __UINT64_MAX__ 18446744073709551615UL
-// NVPTX64:#define __UINT64_TYPE__ long unsigned int
+// NVPTX64:#define __UINT64_C_SUFFIX__ ULL
+// NVPTX64:#define __UINT64_MAX__ 18446744073709551615ULL
+// NVPTX64:#define __UINT64_TYPE__ long long unsigned int
// NVPTX64:#define __UINT8_C_SUFFIX__ U
// NVPTX64:#define __UINT8_MAX__ 255U
// NVPTX64:#define __UINT8_TYPE__ unsigned char
@@ -5483,9 +5483,9 @@
// S390X:#define __UINT32_C_SUFFIX__ U
// S390X:#define __UINT32_MAX__ 4294967295U
// S390X:#define __UINT32_TYPE__ unsigned int
-// S390X:#define __UINT64_C_SUFFIX__ UL
-// S390X:#define __UINT64_MAX__ 18446744073709551615UL
-// S390X:#define __UINT64_TYPE__ long unsigned int
+// S390X:#define __UINT64_C_SUFFIX__ ULL
+// S390X:#define __UINT64_MAX__ 18446744073709551615ULL
+// S390X:#define __UINT64_TYPE__ long long unsigned int
// S390X:#define __UINT8_C_SUFFIX__ U
// S390X:#define __UINT8_MAX__ 255U
// S390X:#define __UINT8_TYPE__ unsigned char
More information about the cfe-commits
mailing list