Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libc/src/stdio/printf_core/vasprintf_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "hdr/func/malloc.h"
#include "hdr/func/realloc.h"
#include "src/__support/arg_list.h"
#include "src/stdio/printf.h"
#include "src/stdio/printf_core/core_structs.h"
#include "src/stdio/printf_core/printf_main.h"
#include "src/stdio/printf_core/writer.h"
Expand Down
1 change: 0 additions & 1 deletion libc/test/src/stdio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ add_libc_test(
libc.src.stdio.vasprintf
libc.src.string.memset
libc.include.stdlib
libc.src.stdio.sprintf
)

if(LLVM_LIBC_FULL_BUILD)
Expand Down
1 change: 1 addition & 0 deletions libc/test/src/stdio/asprintf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ TEST(LlvmLibcASPrintfTest, LargeStringNoConv) {
TEST(LlvmLibcASPrintfTest, ManyReAlloc) {
char *buff = nullptr;
char long_str[1001];
// TODO: simplify test to match with vasprintf_test
auto expected_num_chars =
LIBC_NAMESPACE::sprintf(long_str, "%200s%200s%200s", "a", "b", "c");
long_str[expected_num_chars] = '\0';
Expand Down
1 change: 0 additions & 1 deletion libc/test/src/stdio/vasprintf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//

#include "src/stdio/sprintf.h"
#include "src/stdio/vasprintf.h"
#include "src/string/memset.h"
#include "test/UnitTest/Test.h"
Expand Down
35 changes: 35 additions & 0 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6113,6 +6113,31 @@ libc_support_library(
],
)

libc_support_library(
name = "vasprintf_internal",
hdrs = ["src/stdio/printf_core/vasprintf_internal.h"],
deps = [
":__support_arg_list",
":__support_macros_attributes",
":func_free",
":func_malloc",
":func_realloc",
":printf_main",
":printf_writer",
":types_FILE",
],
)

libc_function(
name = "asprintf",
srcs = ["src/stdio/asprintf.cpp"],
hdrs = ["src/stdio/asprintf.h"],
deps = [
":__support_arg_list",
":vasprintf_internal",
],
)

libc_function(
name = "sprintf",
srcs = ["src/stdio/sprintf.cpp"],
Expand Down Expand Up @@ -6164,6 +6189,16 @@ libc_function(
],
)

libc_function(
name = "vasprintf",
srcs = ["src/stdio/vasprintf.cpp"],
hdrs = ["src/stdio/vasprintf.h"],
deps = [
":__support_arg_list",
":vasprintf_internal",
],
)

libc_function(
name = "vsprintf",
srcs = ["src/stdio/vsprintf.cpp"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ libc_test(
],
)

libc_test(
name = "asprintf_test",
srcs = ["asprintf_test.cpp"],
deps = [
"//libc:asprintf",
"//libc:memset",
"//libc:sprintf",
],
)

libc_test(
name = "sprintf_test",
srcs = ["sprintf_test.cpp"],
Expand Down Expand Up @@ -81,6 +91,15 @@ libc_test(
],
)

libc_test(
name = "vasprintf_test",
srcs = ["vasprintf_test.cpp"],
deps = [
"//libc:memset",
"//libc:vasprintf",
],
)

libc_test(
name = "vsprintf_test",
srcs = ["vsprintf_test.cpp"],
Expand Down
Loading