Implement system header lookup for interop import (#6128)

Using the toolchain-tasks suggested syntax of:
```
import Cpp header "<system_header.h>";
```
This commit is contained in:
David Blaikie
2025-09-25 15:49:06 +00:00
committed by GitHub
parent e3293a4f1f
commit f194acbf96
2 changed files with 59 additions and 4 deletions
+7 -4
View File
@@ -103,10 +103,13 @@ static auto GenerateCppIncludesHeaderCode(
GenerateLineMarker(context, code_stream,
context.tokens().GetLineNumber(
context.parse_tree().node_token(import.node_id)));
code_stream << "#include \""
<< FormatEscaped(
context.string_literal_values().Get(import.library_id))
<< "\"\n";
auto name = context.string_literal_values().Get(import.library_id);
if (name.starts_with('<') && name.ends_with('>')) {
code_stream << "#include <"
<< FormatEscaped(name.drop_front().drop_back()) << ">\n";
} else {
code_stream << "#include \"" << FormatEscaped(name) << "\"\n";
}
}
}