only support int128_t on 64-bit and larger targets. 32-bit targets don't
have support for __divti3 and friends.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70480 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 8ce3ce0..b931cf8 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -18,6 +18,7 @@
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/Lex/Preprocessor.h"
+#include "clang/Basic/TargetInfo.h"
using namespace clang;
/// ConvertQualTypeToStringFn - This function is used to pretty print the
@@ -109,15 +110,17 @@
TUScope = S;
PushDeclContext(S, Context.getTranslationUnitDecl());
- // Install [u]int128_t.
- PushOnScopeChains(TypedefDecl::Create(Context, CurContext,
- SourceLocation(),
- &Context.Idents.get("__int128_t"),
- Context.Int128Ty), TUScope);
- PushOnScopeChains(TypedefDecl::Create(Context, CurContext,
- SourceLocation(),
- &Context.Idents.get("__uint128_t"),
- Context.UnsignedInt128Ty), TUScope);
+ if (PP.getTargetInfo().getPointerWidth(0) >= 64) {
+ // Install [u]int128_t for 64-bit targets.
+ PushOnScopeChains(TypedefDecl::Create(Context, CurContext,
+ SourceLocation(),
+ &Context.Idents.get("__int128_t"),
+ Context.Int128Ty), TUScope);
+ PushOnScopeChains(TypedefDecl::Create(Context, CurContext,
+ SourceLocation(),
+ &Context.Idents.get("__uint128_t"),
+ Context.UnsignedInt128Ty), TUScope);
+ }
if (!PP.getLangOptions().ObjC1) return;