mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user