From 27132e42e90a758da4ebb4090e6421964d10c08b Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Wed, 12 Mar 2014 19:29:05 +0400 Subject: [PATCH] resolving an issue with Debug Info metadata after LLVM_3_4 --- module.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/module.cpp b/module.cpp index 6aeeddfd..67e2bf0e 100644 --- a/module.cpp +++ b/module.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2010-2013, Intel Corporation + Copyright (c) 2010-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -949,6 +949,15 @@ Module::writeOutput(OutputType outputType, const char *outFileName, lStripUnusedDebugInfo(module); } +#if defined (LLVM_3_4) || defined (LLVM_3_5) + // In LLVM_3_4 after r195494 and r195504 revisions we should pass + // "Debug Info Version" constant to the module. LLVM will ignore + // our Debug Info metadata without it. + if (g->generateDebuggingSymbols == true) { + module->addModuleFlag(llvm::Module::Error, "Debug Info Version", llvm::DEBUG_METADATA_VERSION); + } +#endif + // First, issue a warning if the output file suffix and the type of // file being created seem to mismatch. This can help catch missing // command-line arguments specifying the output file type.