Commit Graph
5 Commits
Author SHA1 Message Date
Jon Ross-Perkins b06fcc97f6 Clean up a few details of lex yaml printing (#4845)
- Escape dumped token strings (what got me here)
- Change the quoting from backticks to quotes
- Also add a `FormatEscaped` helper function for this, updating other
`.write_escaped` uses
2025-01-24 21:52:02 +00:00
Boaz Brickner 30c1530261 Support multiple import Cpp library in a single unit (#4814)
Instead of compiling the imported file, generate a C++ header that
includes all `Cpp` import files.
Part of #4666
2025-01-20 09:44:45 +00:00
Jon Ross-PerkinsandGeoff Romer 4c4c4a4d2c Add RawStringOstream for slightly simpler streaming to strings (#4817)
This adds a RawStringOstream. Versus TestRawOstream, which is
consolidated over to RawStringOstream, it uses a string for storage
instead of a vector, mainly to support move-to-string semantics. Versus
llvm::raw_string_ostream, it owns the string and supports pwrite (which
is needed for driver and its fd_ostream compatibility requirement).

This converts most uses of llvm::raw_string_ostream, leaving behind a
few in InstNamer that explicitly cannot own the string, such as:

```
     llvm::raw_string_ostream(name)
          << "_" << tree.tokens().GetColumnNumber(token);
```

I have this as its own library so that it can use CHECK.

Yes this doesn't save much code, but it's code we repeatedly write.

---------

Co-authored-by: Geoff Romer <gromer@google.com>
2025-01-18 01:11:44 +00:00
Boaz Brickner 28d6aedbbb Add Support for #include in cpp files imported from Carbon (#4809)
Propagate `FileSystem` to `buildASTFromCodeWithArgs`().
Part of #4666
2025-01-15 21:27:58 +00:00
Boaz Brickner 5b70a3ea91 Generate AST when importing a cpp file (#4790)
Ignore the AST and support a single Cpp import, for now.
Report cpp compilation errors and warnings.
Part of #4666
2025-01-14 20:45:50 +00:00