summaryrefslogtreecommitdiff
path: root/libc/spec
diff options
context:
space:
mode:
authorMichael Jones <michaelrj@google.com>2022-10-19 13:36:59 -0700
committerMichael Jones <michaelrj@google.com>2022-11-17 15:37:52 -0800
commit36991d8342ca74b68cf74a148af2d1e87823159a (patch)
tree2d9ff264b7800c5b4122c8cb11a1ce0e980b1e64 /libc/spec
parent98bfd7f976f166e2eb7b444f3ee86843815ca73c (diff)
downloadllvm-36991d8342ca74b68cf74a148af2d1e87823159a.tar.gz
[libc] add scanf entrypoints
This patch adds scanf, sscanf, and fscanf entrypoints. It also adds unit tests for sscanf and a basic test to fscanf. The scanf function is basically impossible to test in an automated fashion due to it recieving user input. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D138076
Diffstat (limited to 'libc/spec')
-rw-r--r--libc/spec/stdc.td20
1 files changed, 20 insertions, 0 deletions
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 4d1295313e5a..f439a1a6ba2c 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -634,6 +634,26 @@ def StdC : StandardSpec<"stdc"> {
[ArgSpec<FILERestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
>,
FunctionSpec<
+ "sscanf",
+ RetValSpec<IntType>,
+ [ArgSpec<ConstCharRestrictedPtr>,
+ ArgSpec<ConstCharRestrictedPtr>,
+ ArgSpec<VarArgType>]
+ >,
+ FunctionSpec<
+ "scanf",
+ RetValSpec<IntType>,
+ [ArgSpec<ConstCharRestrictedPtr>,
+ ArgSpec<VarArgType>]
+ >,
+ FunctionSpec<
+ "fscanf",
+ RetValSpec<IntType>,
+ [ArgSpec<FILERestrictedPtr>,
+ ArgSpec<ConstCharRestrictedPtr>,
+ ArgSpec<VarArgType>]
+ >,
+ FunctionSpec<
"sprintf",
RetValSpec<IntType>,
[ArgSpec<CharRestrictedPtr>,