mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-30 23:20:40 +03:00
Implement previously inoperative pragma(LDC_no_moduleinfo).
GitHub: Fixes #571.
This commit is contained in:
parent
1f45eadbfe
commit
04570399d4
5 changed files with 26 additions and 20 deletions
|
@ -136,6 +136,7 @@ Module::Module(const char *filename, Identifier *ident, int doDocComment, int do
|
||||||
#if IN_LLVM
|
#if IN_LLVM
|
||||||
// LDC
|
// LDC
|
||||||
llvmForceLogging = false;
|
llvmForceLogging = false;
|
||||||
|
noModuleInfo = false;
|
||||||
moduleInfoVar = NULL;
|
moduleInfoVar = NULL;
|
||||||
this->doDocComment = doDocComment;
|
this->doDocComment = doDocComment;
|
||||||
this->doHdrGen = doHdrGen;
|
this->doHdrGen = doHdrGen;
|
||||||
|
|
|
@ -207,6 +207,7 @@ public:
|
||||||
llvm::GlobalVariable* moduleInfoSymbol();
|
llvm::GlobalVariable* moduleInfoSymbol();
|
||||||
|
|
||||||
bool llvmForceLogging;
|
bool llvmForceLogging;
|
||||||
|
bool noModuleInfo; /// Do not emit any module metadata.
|
||||||
llvm::GlobalVariable* moduleInfoVar;
|
llvm::GlobalVariable* moduleInfoVar;
|
||||||
|
|
||||||
// array ops emitted in this module already
|
// array ops emitted in this module already
|
||||||
|
|
|
@ -626,18 +626,21 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context)
|
||||||
// finalize debug info
|
// finalize debug info
|
||||||
gIR->DBuilder.EmitModuleEnd();
|
gIR->DBuilder.EmitModuleEnd();
|
||||||
|
|
||||||
|
// Skip emission of all the additional module metadata if requested by the user.
|
||||||
|
if (!noModuleInfo)
|
||||||
|
{
|
||||||
// generate ModuleInfo
|
// generate ModuleInfo
|
||||||
genmoduleinfo();
|
genmoduleinfo();
|
||||||
|
|
||||||
build_llvm_used_array(&ir);
|
build_llvm_used_array(&ir);
|
||||||
|
|
||||||
#if LDC_LLVM_VER >= 303
|
#if LDC_LLVM_VER >= 303
|
||||||
// Add the linker options metadata flag.
|
// Add the linker options metadata flag.
|
||||||
ir.module->addModuleFlag(llvm::Module::AppendUnique, "Linker Options",
|
ir.module->addModuleFlag(llvm::Module::AppendUnique, "Linker Options",
|
||||||
llvm::MDNode::get(ir.context(), ir.LinkerMetadataArgs));
|
llvm::MDNode::get(ir.context(), ir.LinkerMetadataArgs));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LDC_LLVM_VER >= 304
|
#if LDC_LLVM_VER >= 304
|
||||||
// Emit ldc version as llvm.ident metadata.
|
// Emit ldc version as llvm.ident metadata.
|
||||||
llvm::NamedMDNode *IdentMetadata = ir.module->getOrInsertNamedMetadata("llvm.ident");
|
llvm::NamedMDNode *IdentMetadata = ir.module->getOrInsertNamedMetadata("llvm.ident");
|
||||||
std::string Version("ldc version ");
|
std::string Version("ldc version ");
|
||||||
|
@ -646,7 +649,8 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context)
|
||||||
llvm::MDString::get(ir.context(), Version)
|
llvm::MDString::get(ir.context(), Version)
|
||||||
};
|
};
|
||||||
IdentMetadata->addOperand(llvm::MDNode::get(ir.context(), IdentNode));
|
IdentMetadata->addOperand(llvm::MDNode::get(ir.context(), IdentNode));
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// verify the llvm
|
// verify the llvm
|
||||||
verifyModule(*ir.module);
|
verifyModule(*ir.module);
|
||||||
|
|
|
@ -140,7 +140,8 @@ Pragma DtoGetPragma(Scope *sc, PragmaDeclaration *decl, std::string &arg1str)
|
||||||
error(Loc(), "takes no parameters");
|
error(Loc(), "takes no parameters");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
return LLVMno_moduleinfo;
|
sc->module->noModuleInfo = true;
|
||||||
|
return LLVMignore;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pragma(LDC_alloca) { funcdecl(s) }
|
// pragma(LDC_alloca) { funcdecl(s) }
|
||||||
|
|
|
@ -28,7 +28,6 @@ enum Pragma
|
||||||
LLVMglobal_crt_ctor,
|
LLVMglobal_crt_ctor,
|
||||||
LLVMglobal_crt_dtor,
|
LLVMglobal_crt_dtor,
|
||||||
LLVMno_typeinfo,
|
LLVMno_typeinfo,
|
||||||
LLVMno_moduleinfo,
|
|
||||||
LLVMalloca,
|
LLVMalloca,
|
||||||
LLVMva_start,
|
LLVMva_start,
|
||||||
LLVMva_copy,
|
LLVMva_copy,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue