File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -2996,7 +2996,7 @@ void CodeGenFunction::EmitReturnValueCheck(llvm::Value *RV) {
2996
2996
} else {
2997
2997
if (auto *DD = dyn_cast<DeclaratorDecl>(CurCodeDecl))
2998
2998
if (auto *TSI = DD->getTypeSourceInfo ())
2999
- if (auto FTL = TSI->getTypeLoc ().castAs <FunctionTypeLoc>())
2999
+ if (auto FTL = TSI->getTypeLoc ().getAsAdjusted <FunctionTypeLoc>())
3000
3000
AttrLoc = FTL.getReturnLoc ().findNullabilityLoc ();
3001
3001
CheckKind = SanitizerKind::NullabilityReturn;
3002
3002
Handler = SanitizerHandler::NullabilityReturn;
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -fsanitize=nullability-return -emit-llvm %s -o - -triple x86_64-apple-macosx10.10.0 | FileCheck %s
2
+
3
+ // CHECK: [[ATTR_LOC:@[0-9]+]] = {{.*}} global { {{.*}} i32 15, i32 38
4
+
5
+ // CHECK-LABEL: define i8* @_Z3foov()
6
+ // CHECK: [[CALL:%.*]] = call i8* @_Z6helperv()
7
+ // CHECK: icmp ne i8* [[CALL]]
8
+ // CHECK: call void @__ubsan_handle_nullability_return_v1_abort({{.*}}[[ATTR_LOC]]
9
+
10
+ struct S {
11
+ using PtrTy = id ;
12
+ };
13
+
14
+ #pragma clang assume_nonnull begin
15
+ __attribute__ ((ns_returns_retained)) S::PtrTy foo(void ) {
16
+ extern S::PtrTy helper (void );
17
+ return helper ();
18
+ }
19
+ #pragma clang assume_nonnull end
You can’t perform that action at this time.
0 commit comments