if (D.hasAttr<AsmLabelAttr>())
CGM.ErrorUnsupported(&D, "__asm__");
- // We don't support __thread yet.
- if (D.isThreadSpecified())
- CGM.ErrorUnsupported(&D, "thread local ('__thread') variable", true);
-
switch (D.getStorageClass()) {
case VarDecl::None:
case VarDecl::Auto:
const llvm::Type *LTy = CGM.getTypes().ConvertTypeForMem(Ty);
return new llvm::GlobalVariable(LTy, Ty.isConstant(getContext()), Linkage,
llvm::Constant::getNullValue(LTy), Name,
- &CGM.getModule(), 0, Ty.getAddressSpace());
+ &CGM.getModule(), D.isThreadSpecified(),
+ Ty.getAddressSpace());
}
void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) {
GV = new llvm::GlobalVariable(Init->getType(), OldGV->isConstant(),
OldGV->getLinkage(), Init, "",
- &CGM.getModule(), 0,
+ &CGM.getModule(), D.isThreadSpecified(),
D.getType().getAddressSpace());
// Steal the name of the old global
return llvm::ConstantExpr::getBitCast(Entry, Ty);
}
- // We don't support __thread yet.
- if (D && D->isThreadSpecified())
- ErrorUnsupported(D, "thread local ('__thread') variable", true);
-
// This is the first use or definition of a mangled name. If there is a
// deferred decl with this name, remember that we need to emit it at the end
// of the file.
new llvm::GlobalVariable(Ty->getElementType(), false,
llvm::GlobalValue::ExternalLinkage,
0, "", &getModule(),
- 0, Ty->getAddressSpace());
+ false, Ty->getAddressSpace());
GV->setName(MangledName);
// Handle things which are present even on external declarations.
if (D->hasAttr<WeakAttr>() || D->hasAttr<WeakImportAttr>())
GV->setLinkage(llvm::GlobalValue::ExternalWeakLinkage);
+
+ GV->setThreadLocal(D->isThreadSpecified());
}
return Entry = GV;