diff options
author | John Hodge <tpg@mutabah.net> | 2016-12-15 23:27:07 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-12-15 23:27:07 +0800 |
commit | 36de5ba638817d89670e806fd1068bc3fdebecb1 (patch) | |
tree | 1d9fd3d97420608b25fc21e1f0e4c4c58efce5f4 /src/expand/mod.cpp | |
parent | 2e361f85d70fbc07321c50c292b00ffacd095e1e (diff) | |
download | mrust-36de5ba638817d89670e806fd1068bc3fdebecb1.tar.gz |
Codegen - #[link_name] support
Diffstat (limited to 'src/expand/mod.cpp')
-rw-r--r-- | src/expand/mod.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/expand/mod.cpp b/src/expand/mod.cpp index 8cc4ea2e..ab016b95 100644 --- a/src/expand/mod.cpp +++ b/src/expand/mod.cpp @@ -47,13 +47,17 @@ void Expand_Attr(const Span& sp, const ::AST::MetaItem& a, AttrStage stage, ::s } } } -void Expand_Attrs(const ::AST::MetaItems& attrs, AttrStage stage, ::std::function<void(const Span& sp, const ExpandDecorator& d,const ::AST::MetaItem& a)> f) +void Expand_Attrs(/*const */::AST::MetaItems& attrs, AttrStage stage, ::std::function<void(const Span& sp, const ExpandDecorator& d,const ::AST::MetaItem& a)> f) { for( auto& a : attrs.m_items ) { if( a.name() == "cfg_attr" ) { if( check_cfg(attrs.m_span, a.items().at(0)) ) { - Expand_Attr(attrs.m_span, a.items().at(1), stage, f); + auto inner_attr = mv$(a.items().at(1)); + Expand_Attr(attrs.m_span, inner_attr, stage, f); + a = mv$(inner_attr); + } + else { } } else { @@ -61,11 +65,11 @@ void Expand_Attrs(const ::AST::MetaItems& attrs, AttrStage stage, ::std::functi } } } -void Expand_Attrs(const ::AST::MetaItems& attrs, AttrStage stage, ::AST::Crate& crate, const ::AST::Path& path, ::AST::Module& mod, ::AST::Item& item) +void Expand_Attrs(::AST::MetaItems& attrs, AttrStage stage, ::AST::Crate& crate, const ::AST::Path& path, ::AST::Module& mod, ::AST::Item& item) { Expand_Attrs(attrs, stage, [&](const auto& sp, const auto& d, const auto& a){ d.handle(sp, a, crate, path, mod, item); }); } -void Expand_Attrs(const ::AST::MetaItems& attrs, AttrStage stage, ::AST::Crate& crate, ::AST::Module& mod, ::AST::ImplDef& impl) +void Expand_Attrs(::AST::MetaItems& attrs, AttrStage stage, ::AST::Crate& crate, ::AST::Module& mod, ::AST::ImplDef& impl) { Expand_Attrs(attrs, stage, [&](const auto& sp, const auto& d, const auto& a){ d.handle(sp, a, crate, mod, impl); }); } |