From 7fb0923c1f26eb08fac9eeb95b04015097c26686 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 19 May 2014 23:40:06 +0000 Subject: [PATCH] Demote the "Debug Info Version" module flag to llvm::Module::Warning behavior on mismatch. The AutoUpgrader will drop incompatible debug info any way and also emit a warning diagnostic for it. rdar://problem/16926122 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209182 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 10 ++++------ test/CodeGen/debug-info-version.c | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 485beab740..af257c5466 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -301,12 +301,10 @@ void CodeGenModule::Release() { getModule().addModuleFlag(llvm::Module::Warning, "Dwarf Version", CodeGenOpts.DwarfVersion); if (DebugInfo) - // We support a single version in the linked module: error out when - // modules do not have the same version. We are going to implement dropping - // debug info when the version number is not up-to-date. Once that is - // done, the bitcode linker is not going to see modules with different - // version numbers. - getModule().addModuleFlag(llvm::Module::Error, "Debug Info Version", + // We support a single version in the linked module. The LLVM + // parser will drop debug info with a different version number + // (and warn about it, too). + getModule().addModuleFlag(llvm::Module::Warning, "Debug Info Version", llvm::DEBUG_METADATA_VERSION); SimplifyPersonality(); diff --git a/test/CodeGen/debug-info-version.c b/test/CodeGen/debug-info-version.c index 3a74876de5..325345f0b2 100644 --- a/test/CodeGen/debug-info-version.c +++ b/test/CodeGen/debug-info-version.c @@ -4,5 +4,5 @@ int main (void) { return 0; } -// CHECK: metadata !{i32 1, metadata !"Debug Info Version", i32 1} +// CHECK: metadata !{i32 2, metadata !"Debug Info Version", i32 1} // NO_DEBUG-NOT: metadata !"Debug Info Version" -- 2.40.0