summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2013-07-16 23:21:16 +0000
committerManman Ren <mren@apple.com>2013-07-16 23:21:16 +0000
commit8bfde8917ed77b89fe916854b67352884ffb7b16 (patch)
tree0a90b0bd3e820d5582b7cb1aa73396a44556cb2a /llvm/lib/CodeGen/AsmPrinter
parent86bae2c54d34ffecfabdd2a452153f4f871999e1 (diff)
downloadbcm5719-llvm-8bfde8917ed77b89fe916854b67352884ffb7b16.tar.gz
bcm5719-llvm-8bfde8917ed77b89fe916854b67352884ffb7b16.zip
Add getModuleFlag(StringRef Key) to query a module flag given Key.
No functionality change. llvm-svn: 186470
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index a35cfa2ec90..254ecd256d7 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -164,17 +164,10 @@ DIType DbgVariable::getType() const {
/// Return Dwarf Version by checking module flags.
static unsigned getDwarfVersionFromModule(const Module *M) {
- SmallVector<Module::ModuleFlagEntry, 8> ModuleFlags;
- M->getModuleFlagsMetadata(ModuleFlags);
- for (unsigned I = 0, E = ModuleFlags.size(); I < E; ++I) {
- const Module::ModuleFlagEntry &MFE = ModuleFlags[I];
- StringRef Key = MFE.Key->getString();
- Value *Val = MFE.Val;
-
- if (Key == "Dwarf Version")
- return cast<ConstantInt>(Val)->getZExtValue();
- }
- return dwarf::DWARF_VERSION;
+ Value *Val = M->getModuleFlag("Dwarf Version");
+ if (!Val)
+ return dwarf::DWARF_VERSION;
+ return cast<ConstantInt>(Val)->getZExtValue();
}
DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
OpenPOWER on IntegriCloud