diff options
author | John Hodge <tpg@mutabah.net> | 2016-05-21 20:10:25 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-05-21 20:10:25 +0800 |
commit | ad93bc7fda1988e49b4e3a0d85344d7e3dc7df10 (patch) | |
tree | d4fee563f881b5a4ab90dfbb7b40be3486d01349 /src/expand | |
parent | be0892fb5cd1442013ee9e761e60294a374f4566 (diff) | |
download | mrust-ad93bc7fda1988e49b4e3a0d85344d7e3dc7df10.tar.gz |
Parse - Updates for better memory efficiency (hopefully)
Diffstat (limited to 'src/expand')
-rw-r--r-- | src/expand/cfg.cpp | 2 | ||||
-rw-r--r-- | src/expand/file_line.cpp | 2 | ||||
-rw-r--r-- | src/expand/format_args.cpp | 5 | ||||
-rw-r--r-- | src/expand/macro_rules.cpp | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/src/expand/cfg.cpp b/src/expand/cfg.cpp index 1372d982..345c46ab 100644 --- a/src/expand/cfg.cpp +++ b/src/expand/cfg.cpp @@ -88,7 +88,7 @@ class CCfgExpander: ERROR(sp, E0000, "cfg! doesn't take an identifier"); } - auto lex = TTStreamO(tt); + auto lex = TTStream(tt); auto attrs = Parse_MetaItem(lex); DEBUG("cfg!() - " << attrs); diff --git a/src/expand/file_line.cpp b/src/expand/file_line.cpp index a4117d70..2532613f 100644 --- a/src/expand/file_line.cpp +++ b/src/expand/file_line.cpp @@ -10,7 +10,7 @@ class CExpanderFile: ::std::unique_ptr<TokenStream> expand(Span sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override { - return box$( TTStreamO(TokenTree(Token(TOK_STRING, sp.filename))) ); + return box$( TTStreamO(TokenTree(Token(TOK_STRING, sp.filename.c_str()))) ); } }; diff --git a/src/expand/format_args.cpp b/src/expand/format_args.cpp index d12096a7..6a3665ec 100644 --- a/src/expand/format_args.cpp +++ b/src/expand/format_args.cpp @@ -45,7 +45,10 @@ class CFormatArgsExpander: } // TODO: Expand format_args! - return box$( TTStreamO(TokenTree(::std::vector<TokenTree>{TokenTree(TOK_PAREN_OPEN), TokenTree(TOK_PAREN_CLOSE)})) ); + ::std::vector<TokenTree> toks; + toks.push_back( TokenTree(TOK_PAREN_OPEN) ); + toks.push_back( TokenTree(TOK_PAREN_CLOSE) ); + return box$( TTStreamO(TokenTree(mv$(toks))) ); } }; diff --git a/src/expand/macro_rules.cpp b/src/expand/macro_rules.cpp index 562b1468..968bf5f9 100644 --- a/src/expand/macro_rules.cpp +++ b/src/expand/macro_rules.cpp @@ -19,7 +19,7 @@ class CMacroRulesExpander: auto mac = Parse_MacroRules(lex); mod.add_macro( false, ident, mac ); - return box$( TTStreamO(TokenTree()) ); + return ::std::unique_ptr<TokenStream>( new TTStreamO(TokenTree()) ); } }; |