Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into merge-2.064
Browse files Browse the repository at this point in the history
  • Loading branch information
redstar committed Jan 25, 2014
2 parents cc8c19b + 704ab30 commit d6b4000
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gen/module.cpp
Expand Up @@ -59,6 +59,13 @@
#endif
#endif

#if LDC_LLVM_VER >= 304
// FIXME: This is from driver/ldc-version.h.
namespace ldc {
extern const char * const ldc_version;
}
#endif

static llvm::cl::opt<bool> preservePaths("op",
llvm::cl::desc("Do not strip paths from source file"),
llvm::cl::ZeroOrMore);
Expand Down Expand Up @@ -594,6 +601,17 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context)
llvm::MDNode::get(ir.context(), ir.LinkerMetadataArgs));
#endif

#if LDC_LLVM_VER >= 304
// Emit ldc version as llvm.ident metadata.
llvm::NamedMDNode *IdentMetadata = ir.module->getOrInsertNamedMetadata("llvm.ident");
std::string Version("ldc version ");
Version.append(ldc::ldc_version);
llvm::Value *IdentNode[] = {
llvm::MDString::get(ir.context(), Version)
};
IdentMetadata->addOperand(llvm::MDNode::get(ir.context(), IdentNode));
#endif

// verify the llvm
verifyModule(*ir.module);

Expand Down

0 comments on commit d6b4000

Please sign in to comment.