Skip to content

Commit 05419a1

Browse files
committed
remove testing if the examples compile in the test gen script
1 parent d5b33fd commit 05419a1

File tree

1 file changed

+0
-66
lines changed

1 file changed

+0
-66
lines changed

clang/utils/generate_ast_matcher_doc_tests.py

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@
8686
from enum import Enum
8787
from functools import reduce
8888
from pathlib import Path
89-
from subprocess import run
9089
from sys import exit
91-
from tempfile import TemporaryDirectory
92-
from typing import Optional
9390

9491
statistics = defaultdict(int)
9592

@@ -425,64 +422,6 @@ def get_with_lang_spec(args: CompileArgs) -> list:
425422
"""
426423

427424

428-
def can_code_compile(
429-
code: str,
430-
headers: list,
431-
compile_commands,
432-
) -> bool:
433-
"""Check if the code can compile using the provided arguments.
434-
This is used to determine if a code snippet could actually compile in
435-
one of the specified language versions. Provides an earlier warning
436-
than after building and executing the test suite.
437-
438-
Args:
439-
code: The code to test
440-
headers: Headers, if any
441-
compile_commands: The compile arguments, if any
442-
443-
Returns:
444-
If the code compiled with the specified compile arguments.
445-
"""
446-
tmp_dir = TemporaryDirectory()
447-
tmp_path = Path(tmp_dir.name)
448-
449-
is_cuda = compile_commands and compile_commands.is_cuda()
450-
if is_cuda:
451-
return True
452-
453-
code_file_name = "code.cpp"
454-
if compile_commands and compile_commands.lang_spec.cxx == "":
455-
code_file_name = "code.c"
456-
if compile_commands and "cuda" in compile_commands.lang_spec.raw:
457-
code_file_name = "code.cu"
458-
459-
(tmp_path / code_file_name).write_text(code)
460-
461-
for header_name, header_content in headers:
462-
file_path = tmp_path / header_name
463-
file_path.parent.mkdir(parents=True, exist_ok=True)
464-
file_path.write_text(header_content)
465-
466-
args: list[str] = []
467-
if compile_commands:
468-
args = get_with_lang_spec(compile_commands)
469-
470-
invocation = [
471-
"clang",
472-
*args,
473-
"-c",
474-
"-Wno-everything",
475-
code_file_name,
476-
]
477-
res = run(invocation, cwd=tmp_path, check=False)
478-
if res.returncode == 0:
479-
return True
480-
481-
print(f"args: {res.args}")
482-
print(f"code: \n{code}")
483-
return False
484-
485-
486425
class MatchType(Enum):
487426
"""Available types of a match, specified by using the lowercase version in
488427
doxygen: '\\match{type=typestr}'.
@@ -617,11 +556,6 @@ def build_test_case(self):
617556
statistics["skipped_objc"] += 1
618557
return ""
619558

620-
if not can_code_compile(self.code, self.headers, self.compile_args):
621-
self.diag("failed to compile")
622-
statistics["compile_failures"] += 1
623-
return ""
624-
625559
statistics["code_snippets"] += 1
626560

627561
statistics["matches"] += reduce(

0 commit comments

Comments
 (0)