Skip to content

Commit 067202f

Browse files
committed
fwrite doesn't write to the 1st arg
1 parent 6609e6a commit 067202f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

llvm_util/known_fns.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ static bool implict_attrs_(llvm::LibFunc libfn, FnAttrs &attrs,
161161
set_param(0, ParamAttrs::AllocPtr);
162162
RETURN_EXACT();
163163

164-
case llvm::LibFunc_fwrite:
165-
case llvm::LibFunc_fwrite_unlocked:
166164
case llvm::LibFunc_fread:
167165
case llvm::LibFunc_fread_unlocked:
168166
ret_and_args_no_undef();
@@ -172,6 +170,16 @@ static bool implict_attrs_(llvm::LibFunc libfn, FnAttrs &attrs,
172170
set_param(3, ParamAttrs::NoCapture);
173171
RETURN_EXACT();
174172

173+
case llvm::LibFunc_fwrite:
174+
case llvm::LibFunc_fwrite_unlocked:
175+
ret_and_args_no_undef();
176+
attrs.set(FnAttrs::NoThrow);
177+
attrs.set(FnAttrs::NoFree);
178+
set_param(0, ParamAttrs::NoCapture);
179+
set_param(0, ParamAttrs::NoWrite);
180+
set_param(3, ParamAttrs::NoCapture);
181+
RETURN_EXACT();
182+
175183
case llvm::LibFunc_fopen:
176184
ret_and_args_no_undef();
177185
attrs.set(FnAttrs::NoThrow);

0 commit comments

Comments
 (0)