aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-30 06:30:56 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-30 06:30:56 +0000
commit120a1e9d0fc2f1625482df789c47b979b3f2a73f (patch)
treea2e7720d58bba069ef0586e80c88184280db8e26 /clang/lib/Frontend/InitPreprocessor.cpp
parent540e8b1dcdbf9090588f133341a9334ae440d726 (diff)
downloadllvm-120a1e9d0fc2f1625482df789c47b979b3f2a73f.zip
llvm-120a1e9d0fc2f1625482df789c47b979b3f2a73f.tar.gz
llvm-120a1e9d0fc2f1625482df789c47b979b3f2a73f.tar.bz2
Headers: Define __INT64_TYPE__ in terms of getInt64Type(), which isn't always
'long'. The practical upshot is so that the uint64_t we define in our stdint.h ends up being compatible with that defined by gcc (at least on Darwin), which otherwise could lead to type incompatibilities with other system headers. llvm-svn: 107255
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 0745568..889b6e5 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -204,6 +204,12 @@ static void DefineTypeSizeof(llvm::StringRef MacroName, unsigned BitWidth,
static void DefineExactWidthIntType(TargetInfo::IntType Ty,
const TargetInfo &TI, MacroBuilder &Builder) {
int TypeWidth = TI.getTypeWidth(Ty);
+
+ // 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 = TI.getInt64Type();
+
DefineType("__INT" + llvm::Twine(TypeWidth) + "_TYPE__", Ty, Builder);
llvm::StringRef ConstSuffix(TargetInfo::getTypeConstantSuffix(Ty));