info version number.
Will error out when modules have different version numbers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195495
91177308-0d34-0410-b5e6-
96231b3b80d8
// 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();
--- /dev/null
+// 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"