diff options
author | Stefan Gränitz <stefan.graenitz@gmail.com> | 2024-07-03 10:32:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-03 10:32:50 +0200 |
commit | 1787d4b28417ea9f26c0213e8f597cc5bb289144 (patch) | |
tree | a39a4943bf82c943e7cb52d78c5ca3901f6eeb5c /clang/lib/Interpreter/Interpreter.cpp | |
parent | 2a14c0643597c5932af85f22172c99800f9b4a6c (diff) | |
download | llvm-1787d4b28417ea9f26c0213e8f597cc5bb289144.zip llvm-1787d4b28417ea9f26c0213e8f597cc5bb289144.tar.gz llvm-1787d4b28417ea9f26c0213e8f597cc5bb289144.tar.bz2 |
[clang-repl] Fix RuntimeInterfaceBuilder for 32-bit systems (#97071)
When generating runtime interface bindings, extend integral types to the
native register size rather than 64-bit per se
Fixes #94994
Diffstat (limited to 'clang/lib/Interpreter/Interpreter.cpp')
-rw-r--r-- | clang/lib/Interpreter/Interpreter.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index 49dc92d..b4882ab 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -686,10 +686,12 @@ public: } private: - // Force cast these types to uint64 to reduce the number of overloads of - // `__clang_Interpreter_SetValueNoAlloc`. + // Force cast these types to the uint that fits the register size. That way we + // reduce the number of overloads of `__clang_Interpreter_SetValueNoAlloc`. void HandleIntegralOrEnumType(const Type *Ty) { - TypeSourceInfo *TSI = Ctx.getTrivialTypeSourceInfo(Ctx.UnsignedLongLongTy); + uint64_t PtrBits = Ctx.getTypeSize(Ctx.VoidPtrTy); + QualType UIntTy = Ctx.getBitIntType(/*Unsigned=*/true, PtrBits); + TypeSourceInfo *TSI = Ctx.getTrivialTypeSourceInfo(UIntTy); ExprResult CastedExpr = S.BuildCStyleCastExpr(SourceLocation(), TSI, SourceLocation(), E); assert(!CastedExpr.isInvalid() && "Cannot create cstyle cast expr"); |