r180632 - ArrayRefize code. No functionality change.

Benjamin Kramer benny.kra at googlemail.com
Fri Apr 26 14:32:52 PDT 2013


Author: d0k
Date: Fri Apr 26 16:32:52 2013
New Revision: 180632

URL: http://llvm.org/viewvc/llvm-project?rev=180632&view=rev
Log:
ArrayRefize code. No functionality change.

Modified:
    cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=180632&r1=180631&r2=180632&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Fri Apr 26 16:32:52 2013
@@ -296,14 +296,14 @@ void CodeGenModule::EmitCXXThreadLocalIn
   if (!CXXThreadLocalInits.empty()) {
     // Generate a guarded initialization function.
     llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, false);
-    InitFn = CreateGlobalInitOrDestructFunction(
-        *this, FTy, "__tls_init", /*TLS*/ true);
+    InitFn = CreateGlobalInitOrDestructFunction(*this, FTy, "__tls_init",
+                                                /*TLS*/ true);
     llvm::GlobalVariable *Guard = new llvm::GlobalVariable(
         getModule(), Int8Ty, false, llvm::GlobalVariable::InternalLinkage,
         llvm::ConstantInt::get(Int8Ty, 0), "__tls_guard");
     Guard->setThreadLocal(true);
-    CodeGenFunction(*this).GenerateCXXGlobalInitFunc(
-        InitFn, CXXThreadLocalInits.data(), CXXThreadLocalInits.size(), Guard);
+    CodeGenFunction(*this)
+        .GenerateCXXGlobalInitFunc(InitFn, CXXThreadLocalInits, Guard);
   }
 
   getCXXABI().EmitThreadLocalInitFuncs(CXXThreadLocals, InitFn);
@@ -351,9 +351,7 @@ CodeGenModule::EmitCXXGlobalInitFunc() {
       for (; I < PrioE; ++I)
         LocalCXXGlobalInits.push_back(I->second);
 
-      CodeGenFunction(*this).GenerateCXXGlobalInitFunc(Fn,
-                                                    &LocalCXXGlobalInits[0],
-                                                    LocalCXXGlobalInits.size());
+      CodeGenFunction(*this).GenerateCXXGlobalInitFunc(Fn, LocalCXXGlobalInits);
       AddGlobalCtor(Fn, Priority);
     }
   }
@@ -361,9 +359,7 @@ CodeGenModule::EmitCXXGlobalInitFunc() {
   llvm::Function *Fn = 
     CreateGlobalInitOrDestructFunction(*this, FTy, "_GLOBAL__I_a");
 
-  CodeGenFunction(*this).GenerateCXXGlobalInitFunc(Fn,
-                                                   &CXXGlobalInits[0],
-                                                   CXXGlobalInits.size());
+  CodeGenFunction(*this).GenerateCXXGlobalInitFunc(Fn, CXXGlobalInits);
   AddGlobalCtor(Fn);
 
   CXXGlobalInits.clear();
@@ -410,10 +406,10 @@ void CodeGenFunction::GenerateCXXGlobalV
   FinishFunction();
 }
 
-void CodeGenFunction::GenerateCXXGlobalInitFunc(llvm::Function *Fn,
-                                                llvm::Constant **Decls,
-                                                unsigned NumDecls,
-                                                llvm::GlobalVariable *Guard) {
+void
+CodeGenFunction::GenerateCXXGlobalInitFunc(llvm::Function *Fn,
+                                           ArrayRef<llvm::Constant *> Decls,
+                                           llvm::GlobalVariable *Guard) {
   // Initialize debug info if needed.
   maybeInitializeDebugInfo();
 
@@ -445,8 +441,8 @@ void CodeGenFunction::GenerateCXXGlobalI
     llvm::Value *token = EmitObjCAutoreleasePoolPush();
     EmitObjCAutoreleasePoolCleanup(token);
   }
-  
-  for (unsigned i = 0; i != NumDecls; ++i)
+
+  for (unsigned i = 0, e = Decls.size(); i != e; ++i)
     if (Decls[i])
       EmitRuntimeCall(Decls[i]);
 

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=180632&r1=180631&r2=180632&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Fri Apr 26 16:32:52 2013
@@ -2668,8 +2668,7 @@ public:
   /// GenerateCXXGlobalInitFunc - Generates code for initializing global
   /// variables.
   void GenerateCXXGlobalInitFunc(llvm::Function *Fn,
-                                 llvm::Constant **Decls,
-                                 unsigned NumDecls,
+                                 ArrayRef<llvm::Constant *> Decls,
                                  llvm::GlobalVariable *Guard = 0);
 
   /// GenerateCXXGlobalDtorsFunc - Generates code for destroying global





More information about the cfe-commits mailing list