Add -Zinput-stats

Emits loc, and node count - before and after expansion.

E.g.,

```
rustc: x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore
Lines of code:             32060
Pre-expansion node count:  120205
Post-expansion node count: 482749
```
This commit is contained in:
Nick Cameron
2015-11-11 18:26:14 +13:00
parent f1f5c04c07
commit f7dc917ba4
5 changed files with 218 additions and 26 deletions

View File

@@ -559,6 +559,10 @@ impl FileMap {
pub fn is_imported(&self) -> bool {
self.src.is_none()
}
fn count_lines(&self) -> usize {
self.lines.borrow().len()
}
}
/// An abstraction over the fs operations used by the Parser.
@@ -1021,6 +1025,10 @@ impl CodeMap {
debug!("span_allows_unstable? {}", allows_unstable);
allows_unstable
}
pub fn count_lines(&self) -> usize {
self.files.borrow().iter().fold(0, |a, f| a + f.count_lines())
}
}
// _____________________________________________________________________________