Skip to content

Commit 72cf581

Browse files
committed
fix f-string containing backslash
1 parent 49b7206 commit 72cf581

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clang/utils/generate_ast_matcher_doc_tests.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,10 @@ def build_test_case(self):
610610
res += "#if LLVM_HAS_NVPTX_TARGET\n"
611611

612612
res += f"""TEST_P(ASTMatchersDocTest, docs_{self.line + 1}) {{
613-
const StringRef Code = R"cpp(\n{"\t#include \"cuda.h\"\n" if has_cuda else ""}{self.code})cpp";\n"""
613+
const StringRef Code = R"cpp(\n"""
614+
if has_cuda:
615+
res += '\t#include "cuda.h"\n'
616+
res += f'{self.code})cpp";\n'
614617

615618
if self.has_headers():
616619
res += f"\tconst FileContentMappings VirtualMappedFiles = {{{self.get_formated_headers()}}};"
@@ -1058,6 +1061,7 @@ def group_doc_comment_and_followed_code(
10581061

10591062
return result
10601063

1064+
10611065
test_file_begin = """
10621066
// unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp - AST matcher unit tests//
10631067
//
@@ -1117,6 +1121,7 @@ def group_doc_comment_and_followed_code(
11171121
} // namespace clang
11181122
"""
11191123

1124+
11201125
def main():
11211126
args = parse_arguments()
11221127

@@ -1162,5 +1167,6 @@ def main():
11621167

11631168
exit(1)
11641169

1170+
11651171
if __name__ == "__main__":
11661172
main()

0 commit comments

Comments
 (0)