@@ -2156,7 +2156,13 @@ static ExprResult PointerAuthAuthAndResign(Sema &S, CallExpr *Call) {
2156
2156
return Call;
2157
2157
}
2158
2158
2159
- static ExprResult BuiltinLaunder(Sema &S, CallExpr *TheCall) {
2159
+ // Semantic check for function arguments of __builtin_launder or
2160
+ // __builtin_start_object_lifetime.
2161
+ static ExprResult SemaBuiltinLaunderOrStartObjectLifetime(Sema &S,
2162
+ CallExpr *TheCall,
2163
+ unsigned BuiltinID) {
2164
+ assert(BuiltinID == Builtin::BI__builtin_launder ||
2165
+ BuiltinID == Builtin::BI__builtin_start_object_lifetime);
2160
2166
if (checkArgCount(S, TheCall, 1))
2161
2167
return ExprError();
2162
2168
@@ -2187,8 +2193,10 @@ static ExprResult BuiltinLaunder(Sema &S, CallExpr *TheCall) {
2187
2193
return std::optional<unsigned>{};
2188
2194
}();
2189
2195
if (DiagSelect) {
2190
- S.Diag(TheCall->getBeginLoc(), diag::err_builtin_launder_invalid_arg)
2191
- << *DiagSelect << TheCall->getSourceRange();
2196
+ S.Diag(TheCall->getBeginLoc(),
2197
+ diag::err_builtin_launder_or_start_object_lifetime_invalid_arg)
2198
+ << *DiagSelect << (BuiltinID == Builtin::BI__builtin_launder ? 0 : 1)
2199
+ << TheCall->getSourceRange();
2192
2200
return ExprError();
2193
2201
}
2194
2202
@@ -2644,7 +2652,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
2644
2652
}
2645
2653
case Builtin::BI__builtin_start_object_lifetime:
2646
2654
case Builtin::BI__builtin_launder:
2647
- return BuiltinLaunder (*this, TheCall);
2655
+ return SemaBuiltinLaunderOrStartObjectLifetime (*this, TheCall, BuiltinID );
2648
2656
case Builtin::BI__sync_fetch_and_add:
2649
2657
case Builtin::BI__sync_fetch_and_add_1:
2650
2658
case Builtin::BI__sync_fetch_and_add_2:
0 commit comments