-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash in ObjC codegen introduced with 5ab6ee7
5ab6ee7 assumed that if `RValue::isScalar()` returns true then `RValue::getScalarVal` will return a valid value. This is not the case when the return value is `void` and so void message returns would crash if they hit this path. This is triggered only for cases where the nil-handling path needs to do something non-trivial (destroy arguments that should be consumed by the callee). Reviewed By: triplef Differential Revision: https://reviews.llvm.org/D123898
- Loading branch information
1 parent
0708771
commit 94c3b16
Showing
2 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
clang/test/CodeGenObjC/gnustep2-nontrivial-destructor-argument.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RUN: %clang_cc1 -triple x86_64-unknow-windows-msvc -S -emit-llvm -fobjc-runtime=gnustep-2.0 -o - %s | ||
|
||
// Regression test. Ensure that C++ arguments with non-trivial destructors | ||
// don't crash the compiler. | ||
|
||
struct X | ||
{ | ||
int a; | ||
~X(); | ||
}; | ||
|
||
@protocol Y | ||
- (void)foo: (X)bar; | ||
@end | ||
|
||
|
||
void test(id<Y> obj) | ||
{ | ||
X a{12}; | ||
[obj foo: a]; | ||
} | ||
|