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
This commit is contained in:
Daniel Dunbar
2010-06-30 06:30:56 +00:00
parent 540e8b1dcd
commit 120a1e9d0f
4 changed files with 19 additions and 9 deletions

View File

@@ -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));