aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorMatt Jacobson <mhjacobson@me.com>2022-08-06 01:01:35 -0400
committerMatt Jacobson <mhjacobson@me.com>2022-11-10 02:10:30 -0500
commitdd9f7963e434a53e8d70f607392ee9abf76f1d99 (patch)
tree227aa315ef6427466185d5b5ac37eb7acc67fd74 /clang/lib/CodeGen/CodeGenFunction.h
parent18df04c944593e53705f64fd2befa804408ab521 (diff)
downloadllvm-dd9f7963e434a53e8d70f607392ee9abf76f1d99.zip
llvm-dd9f7963e434a53e8d70f607392ee9abf76f1d99.tar.gz
llvm-dd9f7963e434a53e8d70f607392ee9abf76f1d99.tar.bz2
[ObjC] avoid crashing when emitting synthesized getter/setter and ptrdiff_t is smaller than long
On targets where ptrdiff_t is smaller than long, clang crashes when emitting synthesized getters/setters that call objc_[gs]etProperty. Explicitly emit a zext/trunc of the ivar offset value (which is defined to long) to ptrdiff_t, which objc_[gs]etProperty takes. Add a test using the AVR target, where ptrdiff_t is smaller than long. Test failed previously and passes now. Differential Revision: https://reviews.llvm.org/D112049
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 05e5bad..7ef22eb 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -3974,6 +3974,8 @@ public:
llvm::Value *EmitIvarOffset(const ObjCInterfaceDecl *Interface,
const ObjCIvarDecl *Ivar);
+ llvm::Value *EmitIvarOffsetAsPointerDiff(const ObjCInterfaceDecl *Interface,
+ const ObjCIvarDecl *Ivar);
LValue EmitLValueForField(LValue Base, const FieldDecl* Field);
LValue EmitLValueForLambdaField(const FieldDecl *Field);