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;
|
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() {
|
void TargetRegistry::printRegisteredTargetsForVersion() {
|
||||||
std::vector<std::pair<StringRef, const Target*> > Targets;
|
std::vector<std::pair<StringRef, const Target*> > Targets;
|
||||||
size_t Width = 0;
|
size_t Width = 0;
|
||||||
|
@ -136,11 +141,7 @@ void TargetRegistry::printRegisteredTargetsForVersion() {
|
||||||
Targets.push_back(std::make_pair(I->getName(), &*I));
|
Targets.push_back(std::make_pair(I->getName(), &*I));
|
||||||
Width = std::max(Width, Targets.back().first.size());
|
Width = std::max(Width, Targets.back().first.size());
|
||||||
}
|
}
|
||||||
array_pod_sort(Targets.begin(), Targets.end(),
|
array_pod_sort(Targets.begin(), Targets.end(), TargetArraySortFn);
|
||||||
[](const std::pair<StringRef, const Target *> *LHS,
|
|
||||||
const std::pair<StringRef, const Target *> *RHS) {
|
|
||||||
return LHS->first.compare(RHS->first);
|
|
||||||
});
|
|
||||||
|
|
||||||
raw_ostream &OS = outs();
|
raw_ostream &OS = outs();
|
||||||
OS << " Registered Targets:\n";
|
OS << " Registered Targets:\n";
|
||||||
|
|
|
@ -2860,6 +2860,10 @@ bool GlobalOpt::OptimizeGlobalCtorsList(GlobalVariable *&GCL) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int compareNames(Constant *const *A, Constant *const *B) {
|
||||||
|
return (*A)->getName().compare((*B)->getName());
|
||||||
|
}
|
||||||
|
|
||||||
static void setUsedInitializer(GlobalVariable &V,
|
static void setUsedInitializer(GlobalVariable &V,
|
||||||
SmallPtrSet<GlobalValue *, 8> Init) {
|
SmallPtrSet<GlobalValue *, 8> Init) {
|
||||||
if (Init.empty()) {
|
if (Init.empty()) {
|
||||||
|
@ -2878,10 +2882,7 @@ static void setUsedInitializer(GlobalVariable &V,
|
||||||
UsedArray.push_back(Cast);
|
UsedArray.push_back(Cast);
|
||||||
}
|
}
|
||||||
// Sort to get deterministic order.
|
// Sort to get deterministic order.
|
||||||
array_pod_sort(UsedArray.begin(), UsedArray.end(),
|
array_pod_sort(UsedArray.begin(), UsedArray.end(), compareNames);
|
||||||
[](Constant *const *A, Constant *const *B) {
|
|
||||||
return (*A)->getName().compare((*B)->getName());
|
|
||||||
});
|
|
||||||
ArrayType *ATy = ArrayType::get(Int8PtrTy, UsedArray.size());
|
ArrayType *ATy = ArrayType::get(Int8PtrTy, UsedArray.size());
|
||||||
|
|
||||||
Module *M = V.getParent();
|
Module *M = V.getParent();
|
||||||
|
|
Loading…
Reference in New Issue