about summary refs log tree commit diff
path: root/src/librustc/hir
diff options
context:
space:
mode:
authorWesley Wiser <wwiser@gmail.com>2018-01-30 22:39:23 -0500
committerWesley Wiser <wwiser@gmail.com>2018-03-06 19:58:02 -0500
commit4f840a683aebb40a4eec0285a49962dfbc8f425b (patch)
tree42a46993b1e9c9ecd2658f41aa4cc29bbf3e012d /src/librustc/hir
parente8cd6cc23783a6a020d2c14f1a0f343a6267195d (diff)
downloadrust-4f840a683aebb40a4eec0285a49962dfbc8f425b.tar.gz
rust-4f840a683aebb40a4eec0285a49962dfbc8f425b.zip
Add `inline` to `TransFnAttrs`
Part of #47320
Diffstat (limited to 'src/librustc/hir')
-rw-r--r--src/librustc/hir/mod.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index 5de341ef511..f997a57d5d7 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -36,6 +36,7 @@ use syntax::codemap::{self, Spanned};
 use syntax::abi::Abi;
 use syntax::ast::{self, Name, NodeId, DUMMY_NODE_ID, AsmDialect};
 use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, MetaItem};
+use syntax::attr::InlineAttr;
 use syntax::ext::hygiene::SyntaxContext;
 use syntax::ptr::P;
 use syntax::symbol::{Symbol, keywords};
@@ -2214,6 +2215,7 @@ pub fn provide(providers: &mut Providers) {
 #[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
 pub struct TransFnAttrs {
     pub flags: TransFnAttrFlags,
+    pub inline: InlineAttr,
 }
 
 bitflags! {
@@ -2231,6 +2233,15 @@ impl TransFnAttrs {
     pub fn new() -> TransFnAttrs {
         TransFnAttrs {
             flags: TransFnAttrFlags::empty(),
+            inline: InlineAttr::None,
+        }
+    }
+
+    /// True if `#[inline]` or `#[inline(always)]` is present.
+    pub fn requests_inline(&self) -> bool {
+        match self.inline {
+            InlineAttr::Hint | InlineAttr::Always => true,
+            InlineAttr::None | InlineAttr::Never => false,
         }
     }
 }