[cfe-commits] r106511 - in /cfe/trunk/lib/CodeGen: CGDeclCXX.cpp CodeGenModule.h
Fariborz Jahanian
fjahanian at apple.com
Mon Jun 21 17:23:09 PDT 2010
Author: fjahanian
Date: Mon Jun 21 19:23:08 2010
New Revision: 106511
URL: http://llvm.org/viewvc/llvm-project?rev=106511&view=rev
Log:
Per Chris's comment, remove another static (this one
is a static comparator operator).
Modified:
cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=106511&r1=106510&r2=106511&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Mon Jun 21 19:23:08 2010
@@ -180,22 +180,6 @@
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
CodeGenModule::EmitCXXGlobalInitFunc() {
if (CXXGlobalInits.empty() && PrioritizedCXXGlobalInits.empty())
@@ -212,8 +196,7 @@
if (!PrioritizedCXXGlobalInits.empty()) {
llvm::SmallVector<llvm::Constant*, 8> LocalCXXGlobalInits;
llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(),
- PrioritizedCXXGlobalInits.end(),
- PrioritizedCXXGlobalInitsCmp);
+ PrioritizedCXXGlobalInits.end());
for (unsigned i = 0; i < PrioritizedCXXGlobalInits.size(); i++) {
llvm::Function *Fn = PrioritizedCXXGlobalInits[i].second;
LocalCXXGlobalInits.push_back(Fn);
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=106511&r1=106510&r2=106511&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Mon Jun 21 19:23:08 2010
@@ -80,6 +80,20 @@
unsigned int lex_order;
OrderGlobalInits(unsigned int p, unsigned int 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;
/// CodeGenModule - This class organizes the cross-function state that is used
More information about the cfe-commits
mailing list