forked from OSchip/llvm-project
Per Chris's comment, remove another static (this one
is a static comparator operator). llvm-svn: 106511
This commit is contained in:
parent
7c3f7fee41
commit
469b200321
|
@ -180,22 +180,6 @@ CodeGenModule::EmitCXXGlobalVarDeclInitFunc(const VarDecl *D) {
|
||||||
CXXGlobalInits.push_back(Fn);
|
CXXGlobalInits.push_back(Fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::pair<CodeGen::OrderGlobalInitsType,
|
|
||||||
llvm::Function *> global_init_pair;
|
|
||||||
static int PrioritizedCXXGlobalInitsCmp(const void* a, const void* b) {
|
|
||||||
const global_init_pair *LHS = static_cast<const global_init_pair*>(a);
|
|
||||||
const global_init_pair *RHS = static_cast<const global_init_pair*>(b);
|
|
||||||
if (LHS->first.priority < RHS->first.priority)
|
|
||||||
return -1;
|
|
||||||
if (LHS->first.priority == RHS->first.priority) {
|
|
||||||
if (LHS->first.lex_order < RHS->first.lex_order)
|
|
||||||
return -1;
|
|
||||||
if (LHS->first.lex_order == RHS->first.lex_order)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return +1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CodeGenModule::EmitCXXGlobalInitFunc() {
|
CodeGenModule::EmitCXXGlobalInitFunc() {
|
||||||
if (CXXGlobalInits.empty() && PrioritizedCXXGlobalInits.empty())
|
if (CXXGlobalInits.empty() && PrioritizedCXXGlobalInits.empty())
|
||||||
|
@ -212,8 +196,7 @@ CodeGenModule::EmitCXXGlobalInitFunc() {
|
||||||
if (!PrioritizedCXXGlobalInits.empty()) {
|
if (!PrioritizedCXXGlobalInits.empty()) {
|
||||||
llvm::SmallVector<llvm::Constant*, 8> LocalCXXGlobalInits;
|
llvm::SmallVector<llvm::Constant*, 8> LocalCXXGlobalInits;
|
||||||
llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(),
|
llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(),
|
||||||
PrioritizedCXXGlobalInits.end(),
|
PrioritizedCXXGlobalInits.end());
|
||||||
PrioritizedCXXGlobalInitsCmp);
|
|
||||||
for (unsigned i = 0; i < PrioritizedCXXGlobalInits.size(); i++) {
|
for (unsigned i = 0; i < PrioritizedCXXGlobalInits.size(); i++) {
|
||||||
llvm::Function *Fn = PrioritizedCXXGlobalInits[i].second;
|
llvm::Function *Fn = PrioritizedCXXGlobalInits[i].second;
|
||||||
LocalCXXGlobalInits.push_back(Fn);
|
LocalCXXGlobalInits.push_back(Fn);
|
||||||
|
|
|
@ -80,6 +80,20 @@ namespace CodeGen {
|
||||||
unsigned int lex_order;
|
unsigned int lex_order;
|
||||||
OrderGlobalInits(unsigned int p, unsigned int l)
|
OrderGlobalInits(unsigned int p, unsigned int l)
|
||||||
: priority(p), lex_order(l) {}
|
: priority(p), lex_order(l) {}
|
||||||
|
friend bool operator==(const OrderGlobalInits &LHS,
|
||||||
|
const OrderGlobalInits &RHS) {
|
||||||
|
return LHS.priority == RHS.priority &&
|
||||||
|
LHS.lex_order == RHS.lex_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend bool operator<(const OrderGlobalInits &LHS,
|
||||||
|
const OrderGlobalInits &RHS) {
|
||||||
|
if (LHS.priority < RHS.priority)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return LHS.priority == RHS.priority &&
|
||||||
|
LHS.lex_order < RHS.lex_order;
|
||||||
|
}
|
||||||
} OrderGlobalInitsType;
|
} OrderGlobalInitsType;
|
||||||
|
|
||||||
/// CodeGenModule - This class organizes the cross-function state that is used
|
/// CodeGenModule - This class organizes the cross-function state that is used
|
||||||
|
|
Loading…
Reference in New Issue