[llvm-commits] [poolalloc] r102860 - /poolalloc/branches/release_26/lib/PoolAllocate/PoolAllocate.cpp

Patrick Simmons simmon12 at illinois.edu
Sun May 2 00:26:50 PDT 2010


Author: psimmons
Date: Sun May  2 02:26:50 2010
New Revision: 102860

URL: http://llvm.org/viewvc/llvm-project?rev=102860&view=rev
Log:
Fix bug for programs not including pthread.h

Modified:
    poolalloc/branches/release_26/lib/PoolAllocate/PoolAllocate.cpp

Modified: poolalloc/branches/release_26/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/branches/release_26/lib/PoolAllocate/PoolAllocate.cpp?rev=102860&r1=102859&r2=102860&view=diff
==============================================================================
--- poolalloc/branches/release_26/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/branches/release_26/lib/PoolAllocate/PoolAllocate.cpp Sun May  2 02:26:50 2010
@@ -271,13 +271,16 @@
                                  PoolDescPtrTy, VoidPtrTy, Int32Type, NULL);
 
   Function* pthread_create_func = M->getFunction("pthread_create");
-  Function::arg_iterator i = pthread_create_func->arg_begin();
-  vector<const Type*> non_vararg_params;
-  non_vararg_params.push_back(i++->getType());
-  non_vararg_params.push_back(i++->getType());
-  non_vararg_params.push_back(i++->getType());
-  non_vararg_params.push_back(Int32Type);
-  PoolThreadWrapper = M->getOrInsertFunction("poolalloc_pthread_create",FunctionType::get(Int32Type,non_vararg_params,true));
+  if(pthread_create_func)
+  {
+      Function::arg_iterator i = pthread_create_func->arg_begin();
+      vector<const Type*> non_vararg_params;
+      non_vararg_params.push_back(i++->getType());
+      non_vararg_params.push_back(i++->getType());
+      non_vararg_params.push_back(i++->getType());
+      non_vararg_params.push_back(Int32Type);
+      PoolThreadWrapper = M->getOrInsertFunction("poolalloc_pthread_create",FunctionType::get(Int32Type,non_vararg_params,true));
+  }
 }
 
 static void getCallsOf(Constant *C, std::vector<CallInst*> &Calls) {





More information about the llvm-commits mailing list