diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2009-07-01 03:36:11 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2009-07-01 03:36:11 +0000 |
| commit | 2857ccbaa7b1c755af1b392b13f0636fb0326a24 (patch) | |
| tree | 770d9c528e132a785a57664378f44c16cb228291 | |
| parent | f95fa1b721e997510a19e5392bf326269ac04741 (diff) | |
| download | bcm5719-llvm-2857ccbaa7b1c755af1b392b13f0636fb0326a24.tar.gz bcm5719-llvm-2857ccbaa7b1c755af1b392b13f0636fb0326a24.zip | |
Fix for PR4192: fix the definition of int64_t on x86_64 Linux.
Note that I'm guessing that *BSD and Solaris do the same thing as Linux
here, but it's quite possible I'm wrong; if the following testcase
gives an error on x86-64 with gcc for any of those operating systems, please
tell me:
#include <stdint.h>
int64_t x; long x;
llvm-svn: 74583
| -rw-r--r-- | clang/include/clang/Basic/TargetInfo.h | 4 | ||||
| -rw-r--r-- | clang/lib/Basic/TargetInfo.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/Basic/Targets.cpp | 17 | ||||
| -rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 2 |
4 files changed, 20 insertions, 4 deletions
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h index a59c60b0022..537d553bc2d 100644 --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -76,7 +76,8 @@ public: UnsignedLongLong }; protected: - IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType; + IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType, + Int64Type; public: IntType getSizeType() const { return SizeType; } IntType getIntMaxType() const { return IntMaxType; } @@ -86,6 +87,7 @@ public: } IntType getIntPtrType() const { return IntPtrType; } IntType getWCharType() const { return WCharType; } + IntType getInt64Type() const { return Int64Type; } /// getPointerWidth - Return the width of pointers on this target, for the /// specified address space. diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp index a513cb16886..ba7f190408b 100644 --- a/clang/lib/Basic/TargetInfo.cpp +++ b/clang/lib/Basic/TargetInfo.cpp @@ -41,6 +41,7 @@ TargetInfo::TargetInfo(const std::string &T) : Triple(T) { UIntMaxType = UnsignedLongLong; IntPtrType = SignedLong; WCharType = SignedInt; + Int64Type = SignedLongLong; FloatFormat = &llvm::APFloat::IEEEsingle; DoubleFormat = &llvm::APFloat::IEEEdouble; LongDoubleFormat = &llvm::APFloat::IEEEdouble; diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 286b2e166bf..88dd6f797bc 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -549,6 +549,9 @@ class PPC64TargetInfo : public PPCTargetInfo { public: PPC64TargetInfo(const std::string& triple) : PPCTargetInfo(triple) { LongWidth = LongAlign = PointerWidth = PointerAlign = 64; + IntMaxType = SignedLong; + UIntMaxType = UnsignedLong; + Int64Type = SignedLong; DescriptionString = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" "i64:64:64-f32:32:32-f64:64:64-v128:128:128"; } @@ -940,11 +943,11 @@ class X86_64TargetInfo : public X86TargetInfo { public: X86_64TargetInfo(const std::string &triple) : X86TargetInfo(triple) { LongWidth = LongAlign = PointerWidth = PointerAlign = 64; - DoubleAlign = LongLongAlign = 64; LongDoubleWidth = 128; LongDoubleAlign = 128; IntMaxType = SignedLong; UIntMaxType = UnsignedLong; + Int64Type = SignedLong; RegParmMax = 6; DescriptionString = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" @@ -963,6 +966,16 @@ public: } // end anonymous namespace namespace { +class DarwinX86_64TargetInfo : public DarwinTargetInfo<X86_64TargetInfo> { +public: + DarwinX86_64TargetInfo(const std::string& triple) + : DarwinTargetInfo<X86_64TargetInfo>(triple) { + Int64Type = SignedLongLong; + } +}; +} // end anonymous namespace + +namespace { class ARMTargetInfo : public TargetInfo { enum { Armv4t, @@ -1363,7 +1376,7 @@ TargetInfo* TargetInfo::CreateTargetInfo(const std::string &T) { if (T.find("x86_64-") == 0 || T.find("amd64-") == 0) { if (isDarwin) - return new DarwinTargetInfo<X86_64TargetInfo>(T); + return new DarwinX86_64TargetInfo(T); if (isLinux) return new LinuxTargetInfo<X86_64TargetInfo>(T); if (isOpenBSD) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 05f96073559..e41dfdda07e 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -383,7 +383,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, // 16-bit targets doesn't necessarily have a 64-bit type. if (TI.getLongLongWidth() == 64) - DefineBuiltinMacro(Buf, "__INT64_TYPE__=long long"); + DefineType("__INT64_TYPE__", TI.getInt64Type(), Buf); // Add __builtin_va_list typedef. { |

