From 0915c047c2e8d94eb9c8e726e10e2d1ef63db29c Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Thu, 17 Apr 2014 22:33:50 +0000 Subject: Fix bug 19437 - Only add discriminators for DWARF 4 and above. Summary: This prevents the discriminator generation pass from triggering if the DWARF version being used in the module is prior to 4. Reviewers: echristo, dblaikie CC: llvm-commits Differential Revision: http://reviews.llvm.org/D3413 llvm-svn: 206507 --- llvm/lib/IR/Module.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/lib/IR/Module.cpp') diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp index 43f42bc..5dbed69c 100644 --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -23,6 +23,7 @@ #include "llvm/IR/InstrTypes.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/LeakDetector.h" +#include "llvm/Support/Dwarf.h" #include #include #include @@ -429,3 +430,10 @@ void Module::dropAllReferences() { for(Module::alias_iterator I = alias_begin(), E = alias_end(); I != E; ++I) I->dropAllReferences(); } + +unsigned Module::getDwarfVersion() const { + Value *Val = getModuleFlag("Dwarf Version"); + if (!Val) + return dwarf::DWARF_VERSION; + return cast(Val)->getZExtValue(); +} -- cgit v1.1