aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2014-04-17 22:33:50 +0000
committerDiego Novillo <dnovillo@google.com>2014-04-17 22:33:50 +0000
commit0915c047c2e8d94eb9c8e726e10e2d1ef63db29c (patch)
tree3dbea92edbbe7dccd491690c6c7cc56a0548f660 /llvm/lib/IR/Module.cpp
parent9ced19abe89a248963b629528ff3e0fee930ed98 (diff)
downloadllvm-0915c047c2e8d94eb9c8e726e10e2d1ef63db29c.zip
llvm-0915c047c2e8d94eb9c8e726e10e2d1ef63db29c.tar.gz
llvm-0915c047c2e8d94eb9c8e726e10e2d1ef63db29c.tar.bz2
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
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
-rw-r--r--llvm/lib/IR/Module.cpp8
1 files changed, 8 insertions, 0 deletions
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 <algorithm>
#include <cstdarg>
#include <cstdlib>
@@ -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<ConstantInt>(Val)->getZExtValue();
+}