r195495 - Debug Info: add a "Debug Info Version" module flag to output the current debug
Manman Ren
manman.ren at gmail.com
Fri Nov 22 11:42:45 PST 2013
Author: mren
Date: Fri Nov 22 13:42:45 2013
New Revision: 195495
URL: http://llvm.org/viewvc/llvm-project?rev=195495&view=rev
Log:
Debug Info: add a "Debug Info Version" module flag to output the current debug
info version number.
Will error out when modules have different version numbers.
Added:
cfe/trunk/test/CodeGen/debug-info-version.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=195495&r1=195494&r2=195495&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Nov 22 13:42:45 2013
@@ -258,6 +258,11 @@ void CodeGenModule::Release() {
// We can change from Warning to Latest if such mode is supported.
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.
+ getModule().addModuleFlag(llvm::Module::Error, "Debug Info Version",
+ llvm::dwarf::DEBUG_INFO_VERSION);
SimplifyPersonality();
Added: cfe/trunk/test/CodeGen/debug-info-version.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-version.c?rev=195495&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-version.c (added)
+++ cfe/trunk/test/CodeGen/debug-info-version.c Fri Nov 22 13:42:45 2013
@@ -0,0 +1,8 @@
+// RUN: %clang -g -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s | FileCheck %s --check-prefix=NO_DEBUG
+int main (void) {
+ return 0;
+}
+
+// CHECK: metadata !{i32 1, metadata !"Debug Info Version", i32 1}
+// NO_DEBUG-NOT: metadata !"Debug Info Version"
More information about the cfe-commits
mailing list