forked from OSchip/llvm-project
[C++11] Revert uses of lambdas with array_pod_sort.
Looks like GCC implements the lambda->function pointer conversion differently. llvm-svn: 203294
This commit is contained in:
parent
4cadf292a5
commit
adf1ea8227
|
@ -127,6 +127,11 @@ const Target *TargetRegistry::getClosestTargetForJIT(std::string &Error) {
|
|||
return TheTarget;
|
||||
}
|
||||
|
||||
static int TargetArraySortFn(const std::pair<StringRef, const Target *> *LHS,
|
||||
const std::pair<StringRef, const Target *> *RHS) {
|
||||
return LHS->first.compare(RHS->first);
|
||||
}
|
||||
|
||||
void TargetRegistry::printRegisteredTargetsForVersion() {
|
||||
std::vector<std::pair<StringRef, const Target*> > Targets;
|
||||
size_t Width = 0;
|
||||
|
@ -136,11 +141,7 @@ void TargetRegistry::printRegisteredTargetsForVersion() {
|
|||
Targets.push_back(std::make_pair(I->getName(), &*I));
|
||||
Width = std::max(Width, Targets.back().first.size());
|
||||
}
|
||||
array_pod_sort(Targets.begin(), Targets.end(),
|
||||
[](const std::pair<StringRef, const Target *> *LHS,
|
||||
const std::pair<StringRef, const Target *> *RHS) {
|
||||
return LHS->first.compare(RHS->first);
|
||||
});
|
||||
array_pod_sort(Targets.begin(), Targets.end(), TargetArraySortFn);
|
||||
|
||||
raw_ostream &OS = outs();
|
||||
OS << " Registered Targets:\n";
|
||||
|
|
|
@ -2860,6 +2860,10 @@ bool GlobalOpt::OptimizeGlobalCtorsList(GlobalVariable *&GCL) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static int compareNames(Constant *const *A, Constant *const *B) {
|
||||
return (*A)->getName().compare((*B)->getName());
|
||||
}
|
||||
|
||||
static void setUsedInitializer(GlobalVariable &V,
|
||||
SmallPtrSet<GlobalValue *, 8> Init) {
|
||||
if (Init.empty()) {
|
||||
|
@ -2878,10 +2882,7 @@ static void setUsedInitializer(GlobalVariable &V,
|
|||
UsedArray.push_back(Cast);
|
||||
}
|
||||
// Sort to get deterministic order.
|
||||
array_pod_sort(UsedArray.begin(), UsedArray.end(),
|
||||
[](Constant *const *A, Constant *const *B) {
|
||||
return (*A)->getName().compare((*B)->getName());
|
||||
});
|
||||
array_pod_sort(UsedArray.begin(), UsedArray.end(), compareNames);
|
||||
ArrayType *ATy = ArrayType::get(Int8PtrTy, UsedArray.size());
|
||||
|
||||
Module *M = V.getParent();
|
||||
|
|
Loading…
Reference in New Issue