* The `deriving` attribute, for automatically generating
implementations of certain traits.
* The `static_assert` attribute, for asserting that a static bool is true at compiletime
+* The `thread_local` attribute, for defining a `static mut` as a thread-local. Note that this is
+ only a low-level building block, and is not local to a *task*, nor does it provide safety.
Other attributes may be added or removed during development of the language.
}
}
+pub fn set_thread_local(global: ValueRef, is_thread_local: bool) {
+ unsafe {
+ llvm::LLVMSetThreadLocal(global, is_thread_local as Bool);
+ }
+}
+
pub fn ConstICmp(Pred: IntPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef {
unsafe {
llvm::LLVMConstICmp(Pred as c_ushort, V1, V2)
static other_attrs: &'static [&'static str] = &[
// item-level
"address_insignificant", // can be crate-level too
+ "thread_local", // for statics
"allow", "deny", "forbid", "warn", // lint options
"deprecated", "experimental", "unstable", "stable", "locked", "frozen", //item stability
"crate_map", "cfg", "doc", "export_name", "link_section", "no_freeze",
inlineable = true;
}
+ if attr::contains_name(i.attrs, "thread_local") {
+ lib::llvm::set_thread_local(g, true);
+ }
+
if !inlineable {
debug!("{} not inlined", sym);
ccx.non_inlineable_statics.insert(id);