Support for reading source code from stdin and other unusual places. (#3416)

- Treat an input of `-` as meaning stdin.

- Fix building of an llvm::MemoryBuffer from a non-regular file.

- Do not enforce filename restrictions on non-regular files.

- Do not invent an output file name based on the name of a non-regular
file.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
This commit is contained in:
Richard Smith
2023-11-22 03:48:10 +00:00
committed by GitHub
co-authored by Chandler Carruth
parent a204689893
commit 9154c6410e
10 changed files with 140 additions and 45 deletions
+2 -2
View File
@@ -131,7 +131,7 @@ auto Tree::PrintNode(llvm::raw_ostream& output, Node n, int depth,
}
auto Tree::Print(llvm::raw_ostream& output) const -> void {
output << "- filename: " << tokens_->filename() << "\n"
output << "- filename: " << tokens_->source().filename() << "\n"
<< " parse_tree: [\n";
// Walk the tree just to calculate depths for each node.
@@ -166,7 +166,7 @@ auto Tree::Print(llvm::raw_ostream& output, bool preorder) const -> void {
return;
}
output << "- filename: " << tokens_->filename() << "\n"
output << "- filename: " << tokens_->source().filename() << "\n"
<< " parse_tree: [\n";
// The parse tree is stored in postorder. The preorder can be constructed