[cfe-commits] r106441 - in /cfe/trunk/lib: CodeGen/CGDeclCXX.cpp CodeGen/CodeGenModule.h Sema/SemaDeclAttr.cpp

Douglas Gregor dgregor at apple.com
Mon Jun 21 12:44:02 PDT 2010


On Jun 21, 2010, at 12:40 PM, Chris Lattner wrote:

> 
> On Jun 21, 2010, at 11:45 AM, Fariborz Jahanian wrote:
> 
>> Author: fjahanian
>> Date: Mon Jun 21 13:45:05 2010
>> New Revision: 106441
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=106441&view=rev
>> Log:
>> IRGen for implementation of init-priority attribute.
>> Test case will be checked in llvm test suite.
>> (finishes off radar 8076356).
> 
> Nice!
> 
>> +  if (!PrioritizedCXXGlobalInits.empty()) {
>> +    std::vector<llvm::Constant*> LocalCXXGlobalInits;
>> +    std::sort(PrioritizedCXXGlobalInits.begin(), 
>> +              PrioritizedCXXGlobalInits.end());
> 
> Please use SmallVector and array_pod_sort (from llvm/ADT/STLExtras.h).  Smallvector saves a bit of time.  std::sort is generally bad because it instantiates into a ton of code.


Shouldn't this be a stable_sort, so that globals with the same init_priority are emitted in the order in which they are seen?

	- Doug



More information about the cfe-commits mailing list