Test P1502R1 Standard Library Header Units (#1388)

This commit is contained in:
Stephan T. Lavavej 2020-10-23 00:13:47 -07:00 коммит произвёл GitHub
Родитель 39eb812426
Коммит 624efe1a25
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 1284 добавлений и 1 удалений

Просмотреть файл

@ -661,7 +661,7 @@ namespace pmr {
}
protected:
virtual void* do_allocate(const size_t _Bytes, const size_t _Align) override {
virtual void* do_allocate(size_t _Bytes, size_t _Align) override { // TRANSITION, DevCom-1159869
// allocate from the current buffer or a new larger buffer from upstream
if (!_STD align(_Align, _Bytes, _Current_buffer, _Space_available)) {
_Increase_capacity(_Bytes, _Align);

Просмотреть файл

@ -365,6 +365,7 @@ tests\P1135R6_latch
tests\P1135R6_semaphore
tests\P1165R1_consistently_propagating_stateful_allocators
tests\P1423R3_char8_t_remediation
tests\P1502R1_standard_library_header_units
tests\P1645R1_constexpr_numeric
tests\VSO_0000000_allocator_propagation
tests\VSO_0000000_any_calling_conventions

Просмотреть файл

@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Просмотреть файл

@ -0,0 +1,126 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
from pathlib import Path
from stl.test.format import STLTestFormat, TestStep
class CustomTestFormat(STLTestFormat):
def getBuildSteps(self, test, lit_config, shared):
shared.exec_dir = test.getExecDir()
output_base = test.getOutputBaseName()
output_dir = test.getOutputDir()
source_path = Path(test.getSourcePath())
stl_headers = [
'algorithm',
'any',
'array',
'atomic',
'barrier',
'bit',
'bitset',
'charconv',
'chrono',
'codecvt',
'compare',
'complex',
'concepts',
'condition_variable',
'coroutine',
'deque',
'exception',
'execution',
'filesystem',
# 'format',
'forward_list',
'fstream',
'functional',
'future',
'initializer_list',
'iomanip',
'ios',
'iosfwd',
'iostream',
'istream',
'iterator',
'latch',
'limits',
'list',
'locale',
'map',
'memory_resource',
'memory',
'mutex',
'new',
'numbers',
'numeric',
'optional',
'ostream',
'queue',
'random',
'ranges',
'ratio',
'regex',
'scoped_allocator',
'semaphore',
'set',
'shared_mutex',
# 'source_location',
'span',
'sstream',
'stack',
'stdexcept',
'stop_token',
'streambuf',
'string_view',
'string',
'strstream',
# 'syncstream',
'system_error',
'thread',
'tuple',
'type_traits',
'typeindex',
'typeinfo',
'unordered_map',
'unordered_set',
'utility',
'valarray',
'variant',
'vector',
'version',
]
compile_test_cpp_with_edg = test.cxx.flags.count('/BE') == 1
if compile_test_cpp_with_edg:
test.cxx.flags.remove('/BE')
header_unit_options = []
for header in stl_headers:
header_obj_path = output_dir / (header + '.obj')
header_unit_options.append('/headerUnit')
header_unit_options.append('{0}/{1}={1}.ifc'.format(test.config.cxx_headers, header))
if not compile_test_cpp_with_edg:
header_unit_options.append(str(header_obj_path))
cmd, out_files = test.cxx._basicCmd(source_files = [], out = None,
flags = ['/exportHeader', '<{}>'.format(header), '/Fo{}'.format(str(header_obj_path))],
skip_mode_flags = True)
yield TestStep(cmd, shared.exec_dir, [], test.cxx.compile_env)
if compile_test_cpp_with_edg:
test.cxx.flags.append('/BE')
cmd, out_files, shared.exec_file = \
test.cxx.executeBasedOnFlagsCmd([source_path],
output_dir, shared.exec_dir,
output_base, header_unit_options, [], [])
yield TestStep(cmd, shared.exec_dir, [source_path],
test.cxx.compile_env)

Просмотреть файл

@ -0,0 +1,105 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
use Run;
sub CustomBuildHook()
{
my $cwd = Run::GetCWDName();
my $stl_include_dir = $ENV{STL_INCLUDE_DIR};
my @stl_headers = (
"algorithm",
"any",
"array",
"atomic",
"barrier",
"bit",
"bitset",
"charconv",
"chrono",
"codecvt",
"compare",
"complex",
"concepts",
"condition_variable",
"coroutine",
"deque",
"exception",
"execution",
"filesystem",
# "format",
"forward_list",
"fstream",
"functional",
"future",
"initializer_list",
"iomanip",
"ios",
"iosfwd",
"iostream",
"istream",
"iterator",
"latch",
"limits",
"list",
"locale",
"map",
"memory_resource",
"memory",
"mutex",
"new",
"numbers",
"numeric",
"optional",
"ostream",
"queue",
"random",
"ranges",
"ratio",
"regex",
"scoped_allocator",
"semaphore",
"set",
"shared_mutex",
# "source_location",
"span",
"sstream",
"stack",
"stdexcept",
"stop_token",
"streambuf",
"string_view",
"string",
"strstream",
# "syncstream",
"system_error",
"thread",
"tuple",
"type_traits",
"typeindex",
"typeinfo",
"unordered_map",
"unordered_set",
"utility",
"valarray",
"variant",
"vector",
"version",
);
my $header_unit_options = "";
foreach (@stl_headers) {
$header_unit_options .= " /headerUnit";
$header_unit_options .= " $stl_include_dir/$_=$_.ifc";
$header_unit_options .= " $_.obj";
# TRANSITION, remove /DMSVC_INTERNAL_TESTING after all compiler bugs are fixed
Run::ExecuteCL("/DMSVC_INTERNAL_TESTING /exportHeader \"<$_>\" /Fo$_.obj");
}
# TRANSITION, remove /DMSVC_INTERNAL_TESTING after all compiler bugs are fixed
Run::ExecuteCL("/DMSVC_INTERNAL_TESTING test.cpp /Fe$cwd.exe $header_unit_options");
}
1

Просмотреть файл

@ -0,0 +1,19 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
RUNALL_INCLUDE ..\..\..\universal_prefix.lst
RUNALL_CROSSLIST
PM_CL="/w14365 /D_ENFORCE_FACET_SPECIALIZATIONS=1"
RUNALL_CROSSLIST
PM_CL="/w14640 /Zc:threadSafeInit- /EHsc /std:c++latest"
RUNALL_CROSSLIST
PM_CL="/Zc:preprocessor /D_SILENCE_CXX17_STRSTREAM_DEPRECATION_WARNING"
RUNALL_CROSSLIST
PM_CL="/MD"
PM_CL="/MDd"
PM_CL="/MT"
PM_CL="/MTd"
# RUNALL_CROSSLIST
# PM_CL=""
# PM_CL="/analyze:only" # TRANSITION, works correctly but slowly
# PM_CL="/BE" # TRANSITION, VSO-1232145 "EDG ICEs when consuming Standard Library Header Units"

Просмотреть файл

@ -0,0 +1,10 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import P1502R1_standard_library_header_units.custom_format
config.test_format = \
P1502R1_standard_library_header_units.custom_format.CustomTestFormat(config.test_format.cxx,
config.test_format.execute_external,
config.test_format.build_executor,
config.test_format.test_executor)

Разница между файлами не показана из-за своего большого размера Загрузить разницу