LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar) { GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar); Module::global_iterator I = GV; if (I == GV->getParent()->global_begin()) return 0; return wrap(--I); }
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar) { GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar); Module::global_iterator I = GV; if (++I == GV->getParent()->global_end()) return 0; return wrap(I); }
void moveGlobalVariableInitializer(GlobalVariable &OrigGV, ValueToValueMapTy &VMap, ValueMaterializer *Materializer, GlobalVariable *NewGV) { assert(OrigGV.hasInitializer() && "Nothing to move"); if (!NewGV) NewGV = cast<GlobalVariable>(VMap[&OrigGV]); else assert(VMap[&OrigGV] == NewGV && "Incorrect global variable mapping in VMap."); assert(NewGV->getParent() != OrigGV.getParent() && "moveGlobalVariableInitializer should only be used to move " "initializers between modules"); NewGV->setInitializer(MapValue(OrigGV.getInitializer(), VMap, RF_None, nullptr, Materializer)); }
bool SpecialCaseList::isIn(const GlobalVariable &G, const StringRef Category) const { return isIn(*G.getParent(), Category) || inSectionCategory("global", G.getName(), Category) || inSectionCategory("type", GetGVTypeString(G), Category); }
bool SpecialCaseList::findCategory(const GlobalVariable &G, StringRef &Category) const { return findCategory(*G.getParent(), Category) || findCategory("global", G.getName(), Category) || findCategory("type", GetGVTypeString(G), Category); }
bool BlackList::isIn(const GlobalVariable &G) { return isIn(*G.getParent()) || inSection("global", G.getName()); }
bool BlackList::isInInit(const GlobalVariable &G) { return (isIn(*G.getParent()) || inSection("global-init", G.getName()) || inSection("global-init-type", GetGVTypeString(G))); }