AutoUpgrade.cpp (322855) | AutoUpgrade.cpp (326496) |
---|---|
1//===-- AutoUpgrade.cpp - Implement auto-upgrade helper functions ---------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 2257 unchanged lines hidden (view full) --- 2266 ConstantAsMetadata::get(ConstantInt::get(Int32Ty, Module::Max)), 2267 MDString::get(M.getContext(), ID->getString()), 2268 Op->getOperand(2)}; 2269 ModFlags->setOperand(I, MDNode::get(M.getContext(), Ops)); 2270 Changed = true; 2271 } 2272 } 2273 } | 1//===-- AutoUpgrade.cpp - Implement auto-upgrade helper functions ---------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 2257 unchanged lines hidden (view full) --- 2266 ConstantAsMetadata::get(ConstantInt::get(Int32Ty, Module::Max)), 2267 MDString::get(M.getContext(), ID->getString()), 2268 Op->getOperand(2)}; 2269 ModFlags->setOperand(I, MDNode::get(M.getContext(), Ops)); 2270 Changed = true; 2271 } 2272 } 2273 } |
2274 // Upgrade Objective-C Image Info Section. Removed the whitespce in the 2275 // section name so that llvm-lto will not complain about mismatching 2276 // module flags that is functionally the same. 2277 if (ID->getString() == "Objective-C Image Info Section") { 2278 if (auto *Value = dyn_cast_or_null<MDString>(Op->getOperand(2))) { 2279 SmallVector<StringRef, 4> ValueComp; 2280 Value->getString().split(ValueComp, " "); 2281 if (ValueComp.size() != 1) { 2282 std::string NewValue; 2283 for (auto &S : ValueComp) 2284 NewValue += S.str(); 2285 Metadata *Ops[3] = {Op->getOperand(0), Op->getOperand(1), 2286 MDString::get(M.getContext(), NewValue)}; 2287 ModFlags->setOperand(I, MDNode::get(M.getContext(), Ops)); 2288 Changed = true; 2289 } 2290 } 2291 } |
|
2274 } 2275 2276 // "Objective-C Class Properties" is recently added for Objective-C. We 2277 // upgrade ObjC bitcodes to contain a "Objective-C Class Properties" module 2278 // flag of value 0, so we can correclty downgrade this flag when trying to 2279 // link an ObjC bitcode without this module flag with an ObjC bitcode with 2280 // this module flag. 2281 if (HasObjCFlag && !HasClassProperties) { 2282 M.addModuleFlag(llvm::Module::Override, "Objective-C Class Properties", 2283 (uint32_t)0); 2284 Changed = true; 2285 } 2286 2287 return Changed; 2288} 2289 | 2292 } 2293 2294 // "Objective-C Class Properties" is recently added for Objective-C. We 2295 // upgrade ObjC bitcodes to contain a "Objective-C Class Properties" module 2296 // flag of value 0, so we can correclty downgrade this flag when trying to 2297 // link an ObjC bitcode without this module flag with an ObjC bitcode with 2298 // this module flag. 2299 if (HasObjCFlag && !HasClassProperties) { 2300 M.addModuleFlag(llvm::Module::Override, "Objective-C Class Properties", 2301 (uint32_t)0); 2302 Changed = true; 2303 } 2304 2305 return Changed; 2306} 2307 |
2308void llvm::UpgradeSectionAttributes(Module &M) { 2309 auto TrimSpaces = [](StringRef Section) -> std::string { 2310 SmallVector<StringRef, 5> Components; 2311 Section.split(Components, ','); 2312 2313 SmallString<32> Buffer; 2314 raw_svector_ostream OS(Buffer); 2315 2316 for (auto Component : Components) 2317 OS << ',' << Component.trim(); 2318 2319 return OS.str().substr(1); 2320 }; 2321 2322 for (auto &GV : M.globals()) { 2323 if (!GV.hasSection()) 2324 continue; 2325 2326 StringRef Section = GV.getSection(); 2327 2328 if (!Section.startswith("__DATA, __objc_catlist")) 2329 continue; 2330 2331 // __DATA, __objc_catlist, regular, no_dead_strip 2332 // __DATA,__objc_catlist,regular,no_dead_strip 2333 GV.setSection(TrimSpaces(Section)); 2334 } 2335} 2336 |
|
2290static bool isOldLoopArgument(Metadata *MD) { 2291 auto *T = dyn_cast_or_null<MDTuple>(MD); 2292 if (!T) 2293 return false; 2294 if (T->getNumOperands() < 1) 2295 return false; 2296 auto *S = dyn_cast_or_null<MDString>(T->getOperand(0)); 2297 if (!S) --- 53 unchanged lines hidden --- | 2337static bool isOldLoopArgument(Metadata *MD) { 2338 auto *T = dyn_cast_or_null<MDTuple>(MD); 2339 if (!T) 2340 return false; 2341 if (T->getNumOperands() < 1) 2342 return false; 2343 auto *S = dyn_cast_or_null<MDString>(T->getOperand(0)); 2344 if (!S) --- 53 unchanged lines hidden --- |