mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-23 17:28:54 +00:00
Add getModuleFlag(StringRef Key) to query a module flag given Key.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186470 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -325,6 +325,19 @@ getModuleFlagsMetadata(SmallVectorImpl<ModuleFlagEntry> &Flags) const {
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the corresponding value if Key appears in module flags, otherwise
|
||||
/// return null.
|
||||
Value *Module::getModuleFlag(StringRef Key) const {
|
||||
SmallVector<Module::ModuleFlagEntry, 8> ModuleFlags;
|
||||
getModuleFlagsMetadata(ModuleFlags);
|
||||
for (unsigned I = 0, E = ModuleFlags.size(); I < E; ++I) {
|
||||
const ModuleFlagEntry &MFE = ModuleFlags[I];
|
||||
if (Key == MFE.Key->getString())
|
||||
return MFE.Val;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// getModuleFlagsMetadata - Returns the NamedMDNode in the module that
|
||||
/// represents module-level flags. This method returns null if there are no
|
||||
/// module-level flags.
|
||||
|
Reference in New Issue
Block a user