-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add tests/std. * Update other files. NOTICE.txt Mention the LLVM Project, as its code appears in tests/std/tests/P0220R1_optional/test.cpp and elsewhere. azure-devops/enforce-clang-format.cmd Process everything within tests. This includes libcxx, std, and tr1. docs/cgmanifest.json Update this file for Microsoft-internal purposes. (It records the commit hashes of repos whose source code we've incorporated into our own repo. For llvm-project, this is distinct from the submodule's current commit.) tests/tr1/run.pl Mention runbe.pl in lowercase, to match the file itself. * Improve run.pl and runbe.pl comments.
- Loading branch information
1 parent
ed3cbf3
commit 2b2746d
Showing
710 changed files
with
165,285 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#pragma once | ||
#include <stdio.h> | ||
#include <wchar.h> | ||
|
||
struct constexpr_char_traits { | ||
typedef char char_type; | ||
typedef long int_type; | ||
typedef long pos_type; | ||
typedef long off_type; | ||
typedef mbstate_t state_type; | ||
|
||
static constexpr int compare(const char* first1, const char* first2, size_t count) { | ||
for (; 0 < count; --count, ++first1, ++first2) { | ||
if (!eq(*first1, *first2)) { | ||
return lt(*first1, *first2) ? -1 : +1; | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
static constexpr size_t length(const char* first) { | ||
size_t count = 0; | ||
for (; !eq(*first, char()); ++first) { | ||
++count; | ||
} | ||
|
||
return count; | ||
} | ||
|
||
static constexpr char* copy(char* first1, const char* first2, size_t count) { | ||
char* next = first1; | ||
for (; 0 < count; --count, ++next, ++first2) { | ||
assign(*next, *first2); | ||
} | ||
return first1; | ||
} | ||
|
||
static constexpr char* _Copy_s(char* first1, size_t, const char* first2, size_t count) { | ||
// let's just pretend :) | ||
return copy(first1, first2, count); | ||
} | ||
|
||
static constexpr const char* find(const char* first, size_t count, const char ch) { | ||
for (; 0 < count; --count, ++first) { | ||
if (eq(*first, ch)) { | ||
return first; | ||
} | ||
} | ||
|
||
return nullptr; | ||
} | ||
|
||
static constexpr char* move(char* first1, const char* first2, size_t count) { | ||
char* next = first1; | ||
if (first2 < next && next < first2 + count) { | ||
for (next += count, first2 += count; 0 < count; --count) { | ||
assign(*--next, *--first2); | ||
} | ||
} else { | ||
for (; 0 < count; --count, ++next, ++first2) { | ||
assign(*next, *first2); | ||
} | ||
} | ||
return first1; | ||
} | ||
|
||
static constexpr char* assign(char* first, size_t count, const char ch) { | ||
char* next = first; | ||
for (; 0 < count; --count, ++next) { | ||
assign(*next, ch); | ||
} | ||
|
||
return first; | ||
} | ||
|
||
static constexpr void assign(char& left, const char right) noexcept { | ||
left = right; | ||
} | ||
|
||
static constexpr bool eq(const char left, const char right) noexcept { | ||
return left == right; | ||
} | ||
|
||
static constexpr bool lt(const char left, const char right) noexcept { | ||
return left < right; | ||
} | ||
|
||
static constexpr char to_char_type(const int_type meta) noexcept { | ||
return static_cast<char>(meta); | ||
} | ||
|
||
static constexpr int_type to_int_type(const char ch) noexcept { | ||
return ch; | ||
} | ||
|
||
static constexpr bool eq_int_type(const int_type left, const int_type right) noexcept { | ||
return left == right; | ||
} | ||
|
||
static constexpr int_type not_eof(const int_type meta) noexcept { | ||
return meta != eof() ? meta : !eof(); | ||
} | ||
|
||
static constexpr int_type eof() noexcept { | ||
return EOF; | ||
} | ||
}; |
Oops, something went wrong.