diff options
| author | Björn Steinbrink <bsteinbr@gmail.com> | 2014-07-21 20:57:37 +0200 |
|---|---|---|
| committer | Björn Steinbrink <bsteinbr@gmail.com> | 2014-07-21 21:52:37 +0200 |
| commit | 1654f08e030a59c6438347cd822a82a3da0abbc7 (patch) | |
| tree | 318e55f254920b5c045778b6284940ca0bf0d5be /src/libsyntax | |
| parent | f15d6d28396e8700b6c3f2704204a2769e710403 (diff) | |
| download | rust-1654f08e030a59c6438347cd822a82a3da0abbc7.tar.gz rust-1654f08e030a59c6438347cd822a82a3da0abbc7.zip | |
Allow merging of statics generated by format!()
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/format.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 4b245f2c9fd..8fefd465655 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -316,6 +316,11 @@ impl<'a, 'b> Context<'a, 'b> { /// These attributes are applied to all statics that this syntax extension /// will generate. fn static_attrs(&self) -> Vec<ast::Attribute> { + // Flag statics as `inline` so LLVM can merge duplicate globals as much + // as possible (which we're generating a whole lot of). + let unnamed = self.ecx.meta_word(self.fmtsp, InternedString::new("inline")); + let unnamed = self.ecx.attribute(self.fmtsp, unnamed); + // Do not warn format string as dead code let dead_code = self.ecx.meta_word(self.fmtsp, InternedString::new("dead_code")); @@ -323,7 +328,7 @@ impl<'a, 'b> Context<'a, 'b> { InternedString::new("allow"), vec!(dead_code)); let allow_dead_code = self.ecx.attribute(self.fmtsp, allow_dead_code); - return vec!(allow_dead_code); + return vec!(unnamed, allow_dead_code); } fn rtpath(&self, s: &str) -> Vec<ast::Ident> { |
