156 changes: 156 additions & 0 deletions libc/src/ctype/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,159 @@ add_entrypoint_object(
DEPENDS
libc.src.__support.ctype_utils
)

# Do not build the locale versions in overlay mode.
if(NOT LLVM_LIBC_FULL_BUILD)
return()
endif()

add_entrypoint_object(
isalnum_l
SRCS
isalnum_l.cpp
HDRS
isalnum_l.h
DEPENDS
libc.include.ctype
libc.src.__support.ctype_utils
libc.hdr.types.locale_t
)

add_entrypoint_object(
isalpha_l
SRCS
isalpha_l.cpp
HDRS
isalpha_l.h
DEPENDS
libc.src.__support.ctype_utils
libc.hdr.types.locale_t
)

add_entrypoint_object(
isblank_l
SRCS
isblank_l.cpp
HDRS
isblank_l.h
DEPENDS
libc.hdr.types.locale_t
)

add_entrypoint_object(
iscntrl_l
SRCS
iscntrl_l.cpp
HDRS
iscntrl_l.h
DEPENDS
libc.hdr.types.locale_t
)

add_entrypoint_object(
isdigit_l
SRCS
isdigit_l.cpp
HDRS
isdigit_l.h
DEPENDS
libc.src.__support.ctype_utils
libc.hdr.types.locale_t
)

add_entrypoint_object(
isgraph_l
SRCS
isgraph_l.cpp
HDRS
isgraph_l.h
DEPENDS
libc.src.__support.ctype_utils
libc.hdr.types.locale_t
)

add_entrypoint_object(
islower_l
SRCS
islower_l.cpp
HDRS
islower_l.h
DEPENDS
libc.src.__support.ctype_utils
libc.hdr.types.locale_t
)

add_entrypoint_object(
isprint_l
SRCS
isprint_l.cpp
HDRS
isprint_l.h
DEPENDS
libc.hdr.types.locale_t
)

add_entrypoint_object(
ispunct_l
SRCS
ispunct_l.cpp
HDRS
ispunct_l.h
DEPENDS
libc.src.__support.ctype_utils
libc.hdr.types.locale_t
)

add_entrypoint_object(
isspace_l
SRCS
isspace_l.cpp
HDRS
isspace_l.h
DEPENDS
libc.hdr.types.locale_t
)

add_entrypoint_object(
isupper_l
SRCS
isupper_l.cpp
HDRS
isupper_l.h
DEPENDS
libc.src.__support.ctype_utils
libc.hdr.types.locale_t
)

add_entrypoint_object(
isxdigit_l
SRCS
isxdigit_l.cpp
HDRS
isxdigit_l.h
DEPENDS
libc.src.__support.ctype_utils
libc.hdr.types.locale_t
)

add_entrypoint_object(
tolower_l
SRCS
tolower_l.cpp
HDRS
tolower_l.h
DEPENDS
libc.src.__support.ctype_utils
libc.hdr.types.locale_t
)

add_entrypoint_object(
toupper_l
SRCS
toupper_l.cpp
HDRS
toupper_l.h
DEPENDS
libc.src.__support.ctype_utils
libc.hdr.types.locale_t
)
2 changes: 0 additions & 2 deletions libc/src/ctype/isalnum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, isalnum, (int c)) {
return static_cast<int>(internal::isalnum(static_cast<unsigned>(c)));
}
Expand Down
21 changes: 21 additions & 0 deletions libc/src/ctype/isalnum_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of isalnum -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/isalnum_l.h"
#include "src/__support/ctype_utils.h"

#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, isalnum_l, (int c, locale_t)) {
return static_cast<int>(internal::isalnum(static_cast<unsigned>(c)));
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/isalnum_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for isalnum_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISALNUM_H
#define LLVM_LIBC_SRC_CTYPE_ISALNUM_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int isalnum_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISALNUM_H
2 changes: 0 additions & 2 deletions libc/src/ctype/isalpha.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, isalpha, (int c)) {
return static_cast<int>(internal::isalpha(static_cast<unsigned>(c)));
}
Expand Down
21 changes: 21 additions & 0 deletions libc/src/ctype/isalpha_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of isalpha -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/isalpha_l.h"

#include "src/__support/common.h"
#include "src/__support/ctype_utils.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, isalpha_l, (int c, locale_t)) {
return static_cast<int>(internal::isalpha(static_cast<unsigned>(c)));
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/isalpha_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for isalpha_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISALPHA_H
#define LLVM_LIBC_SRC_CTYPE_ISALPHA_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int isalpha_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISALPHA_H
2 changes: 0 additions & 2 deletions libc/src/ctype/isblank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, isblank, (int c)) {
return static_cast<int>(c == ' ' || c == '\t');
}
Expand Down
20 changes: 20 additions & 0 deletions libc/src/ctype/isblank_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//===-- Implementation of isblank -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/isblank_l.h"

#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, isblank_l, (int c, locale_t)) {
return static_cast<int>(c == ' ' || c == '\t');
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/isblank_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for isblank_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISBLANK_H
#define LLVM_LIBC_SRC_CTYPE_ISBLANK_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int isblank_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISBLANK_H
2 changes: 0 additions & 2 deletions libc/src/ctype/iscntrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, iscntrl, (int c)) {
const unsigned ch = static_cast<unsigned>(c);
return static_cast<int>(ch < 0x20 || ch == 0x7f);
Expand Down
21 changes: 21 additions & 0 deletions libc/src/ctype/iscntrl_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of iscntrl -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/iscntrl_l.h"

#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, iscntrl_l, (int c, locale_t)) {
const unsigned ch = static_cast<unsigned>(c);
return static_cast<int>(ch < 0x20 || ch == 0x7f);
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/iscntrl_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for iscntrl_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISCNTRL_H
#define LLVM_LIBC_SRC_CTYPE_ISCNTRL_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int iscntrl_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISCNTRL_H
2 changes: 0 additions & 2 deletions libc/src/ctype/isdigit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, isdigit, (int c)) {
return static_cast<int>(internal::isdigit(static_cast<unsigned>(c)));
}
Expand Down
20 changes: 20 additions & 0 deletions libc/src/ctype/isdigit_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//===-- Implementation of isdigit -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/isdigit_l.h"
#include "src/__support/common.h"
#include "src/__support/ctype_utils.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, isdigit_l, (int c, locale_t)) {
return static_cast<int>(internal::isdigit(static_cast<unsigned>(c)));
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/isdigit_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for isdigit_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISDIGIT_H
#define LLVM_LIBC_SRC_CTYPE_ISDIGIT_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int isdigit_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISDIGIT_H
2 changes: 0 additions & 2 deletions libc/src/ctype/isgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, isgraph, (int c)) {
return static_cast<int>(internal::isgraph(static_cast<unsigned>(c)));
}
Expand Down
21 changes: 21 additions & 0 deletions libc/src/ctype/isgraph_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of isgraph -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/isgraph_l.h"

#include "src/__support/common.h"
#include "src/__support/ctype_utils.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, isgraph_l, (int c, locale_t)) {
return static_cast<int>(internal::isgraph(static_cast<unsigned>(c)));
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/isgraph_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for isgraph_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISGRAPH_H
#define LLVM_LIBC_SRC_CTYPE_ISGRAPH_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int isgraph_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISGRAPH_H
2 changes: 0 additions & 2 deletions libc/src/ctype/islower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, islower, (int c)) {
return static_cast<int>(internal::islower(static_cast<unsigned>(c)));
}
Expand Down
21 changes: 21 additions & 0 deletions libc/src/ctype/islower_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of islower -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/islower_l.h"
#include "src/__support/ctype_utils.h"

#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, islower_l, (int c, locale_t)) {
return static_cast<int>(internal::islower(static_cast<unsigned>(c)));
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/islower_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for islower_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISLOWER_H
#define LLVM_LIBC_SRC_CTYPE_ISLOWER_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int islower_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISLOWER_H
2 changes: 0 additions & 2 deletions libc/src/ctype/isprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, isprint, (int c)) {
const unsigned ch = static_cast<unsigned>(c);
return static_cast<int>((ch - ' ') < 95);
Expand Down
21 changes: 21 additions & 0 deletions libc/src/ctype/isprint_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of isprint -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/isprint_l.h"

#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, isprint_l, (int c, locale_t)) {
const unsigned ch = static_cast<unsigned>(c);
return static_cast<int>((ch - ' ') < 95);
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/isprint_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for isprint_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISPRINT_H
#define LLVM_LIBC_SRC_CTYPE_ISPRINT_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int isprint_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISPRINT_H
2 changes: 0 additions & 2 deletions libc/src/ctype/ispunct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, ispunct, (int c)) {
const unsigned ch = static_cast<unsigned>(c);
return static_cast<int>(!internal::isalnum(ch) && internal::isgraph(ch));
Expand Down
22 changes: 22 additions & 0 deletions libc/src/ctype/ispunct_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- Implementation of ispunct -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/ispunct_l.h"

#include "src/__support/common.h"
#include "src/__support/ctype_utils.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, ispunct_l, (int c, locale_t)) {
const unsigned ch = static_cast<unsigned>(c);
return static_cast<int>(!internal::isalnum(ch) && internal::isgraph(ch));
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/ispunct_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for ispunct_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISPUNCT_H
#define LLVM_LIBC_SRC_CTYPE_ISPUNCT_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int ispunct_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISPUNCT_H
2 changes: 0 additions & 2 deletions libc/src/ctype/isspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, isspace, (int c)) {
return static_cast<int>(internal::isspace(static_cast<unsigned>(c)));
}
Expand Down
21 changes: 21 additions & 0 deletions libc/src/ctype/isspace_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of isspace -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/isspace_l.h"
#include "src/__support/ctype_utils.h"

#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, isspace_l, (int c, locale_t)) {
return static_cast<int>(internal::isspace(static_cast<unsigned>(c)));
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/isspace_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for isspace_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISSPACE_H
#define LLVM_LIBC_SRC_CTYPE_ISSPACE_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int isspace_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISSPACE_H
2 changes: 0 additions & 2 deletions libc/src/ctype/isupper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, isupper, (int c)) {
return static_cast<int>(internal::isupper(static_cast<unsigned>(c)));
}
Expand Down
21 changes: 21 additions & 0 deletions libc/src/ctype/isupper_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of isupper -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/isupper_l.h"
#include "src/__support/ctype_utils.h"

#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, isupper_l, (int c, locale_t)) {
return static_cast<int>(internal::isupper(static_cast<unsigned>(c)));
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/isupper_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for isupper_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISUPPER_H
#define LLVM_LIBC_SRC_CTYPE_ISUPPER_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int isupper_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISUPPER_H
2 changes: 0 additions & 2 deletions libc/src/ctype/isxdigit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, isxdigit, (int c)) {
const unsigned ch = static_cast<unsigned>(c);
return static_cast<int>(internal::isdigit(ch) || (ch | 32) - 'a' < 6);
Expand Down
22 changes: 22 additions & 0 deletions libc/src/ctype/isxdigit_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- Implementation of isxdigit ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/isxdigit_l.h"
#include "src/__support/ctype_utils.h"

#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, isxdigit_l, (int c, locale_t)) {
const unsigned ch = static_cast<unsigned>(c);
return static_cast<int>(internal::isdigit(ch) || (ch | 32) - 'a' < 6);
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/isxdigit_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for isxdigit_l ----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_ISXDIGIT_H
#define LLVM_LIBC_SRC_CTYPE_ISXDIGIT_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int isxdigit_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_ISXDIGIT_H
2 changes: 0 additions & 2 deletions libc/src/ctype/tolower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, tolower, (int c)) { return internal::tolower(c); }

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/tolower_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of tolower -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/tolower_l.h"
#include "src/__support/ctype_utils.h"

#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, tolower_l, (int c, locale_t)) {
return internal::tolower(c);
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/tolower_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for tolower_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_TOLOWER_H
#define LLVM_LIBC_SRC_CTYPE_TOLOWER_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int tolower_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_TOLOWER_H
2 changes: 0 additions & 2 deletions libc/src/ctype/toupper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace LIBC_NAMESPACE_DECL {

// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, toupper, (int c)) {
if (internal::islower(c))
return c - ('a' - 'A');
Expand Down
23 changes: 23 additions & 0 deletions libc/src/ctype/toupper_l.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===-- Implementation of toupper_l ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/toupper_l.h"
#include "src/__support/ctype_utils.h"

#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, toupper_l, (int c, locale_t)) {
if (internal::islower(c))
return c - ('a' - 'A');
return c;
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/ctype/toupper_l.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for toupper_l -----------------------*-C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_CTYPE_TOUPPER_H
#define LLVM_LIBC_SRC_CTYPE_TOUPPER_H

#include "hdr/types/locale_t.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int toupper_l(int c, locale_t locale);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_CTYPE_TOUPPER_H