summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-09-29 18:02:48 +0000
committerHans Wennborg <hans@hanshq.net>2015-09-29 18:02:48 +0000
commitd16725c31fbb40fcbf0cdf68b2b417ba445c5140 (patch)
treeaa2106c498a11e0fc4d83ec2c59d7e1b70c7e56a /examples
parent23662fba704e684f24d3114bb399c80d5c0afbd9 (diff)
Fix Clang-tidy modernize-use-nullptr warnings in examples and include directories; other minor cleanups.
Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13172 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r--examples/BrainF/BrainF.cpp10
-rw-r--r--examples/Fibonacci/fibonacci.cpp4
-rw-r--r--examples/HowToUseJIT/HowToUseJIT.cpp5
-rw-r--r--examples/Kaleidoscope/Chapter2/toy.cpp2
-rw-r--r--examples/Kaleidoscope/Chapter3/toy.cpp4
-rw-r--r--examples/Kaleidoscope/Chapter4/toy.cpp3
-rw-r--r--examples/Kaleidoscope/Chapter5/toy.cpp3
-rw-r--r--examples/Kaleidoscope/Chapter6/toy.cpp3
-rw-r--r--examples/Kaleidoscope/Chapter7/toy.cpp5
-rw-r--r--examples/Kaleidoscope/Chapter8/toy.cpp5
-rw-r--r--examples/Kaleidoscope/Orc/fully_lazy/toy.cpp12
-rw-r--r--examples/Kaleidoscope/Orc/initial/toy.cpp10
-rw-r--r--examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp10
-rw-r--r--examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp12
-rw-r--r--examples/ParallelJIT/ParallelJIT.cpp15
15 files changed, 49 insertions, 54 deletions
diff --git a/examples/BrainF/BrainF.cpp b/examples/BrainF/BrainF.cpp
index 8026adc8d07..d8c54b50b85 100644
--- a/examples/BrainF/BrainF.cpp
+++ b/examples/BrainF/BrainF.cpp
@@ -29,6 +29,7 @@
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include <iostream>
+
using namespace llvm;
//Set the constants for naming
@@ -44,7 +45,7 @@ Module *BrainF::parse(std::istream *in1, int mem, CompileFlags cf,
comflag = cf;
header(Context);
- readloop(0, 0, 0, Context);
+ readloop(nullptr, nullptr, nullptr, Context);
delete builder;
return module;
}
@@ -68,7 +69,6 @@ void BrainF::header(LLVMContext& C) {
getOrInsertFunction("putchar", IntegerType::getInt32Ty(C),
IntegerType::getInt32Ty(C), NULL));
-
//Function header
//define void @brainf()
@@ -85,7 +85,7 @@ void BrainF::header(LLVMContext& C) {
Constant* allocsize = ConstantExpr::getSizeOf(Int8Ty);
allocsize = ConstantExpr::getTruncOrBitCast(allocsize, IntPtrTy);
ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, Int8Ty, allocsize, val_mem,
- NULL, "arr");
+ nullptr, "arr");
BB->getInstList().push_back(cast<Instruction>(ptr_arr));
//call void @llvm.memset.p0i8.i32(i8 *%arr, i8 0, i32 %d, i32 1, i1 0)
@@ -114,8 +114,6 @@ void BrainF::header(LLVMContext& C) {
ConstantInt::get(C, APInt(32, memtotal/2)),
headreg);
-
-
//Function footer
//brainf.end:
@@ -127,8 +125,6 @@ void BrainF::header(LLVMContext& C) {
//ret void
ReturnInst::Create(C, endbb);
-
-
//Error block for array out of bounds
if (comflag & flag_arraybounds)
{
diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp
index 8092e19380d..a628cee53ff 100644
--- a/examples/Fibonacci/fibonacci.cpp
+++ b/examples/Fibonacci/fibonacci.cpp
@@ -33,6 +33,7 @@
#include "llvm/IR/Module.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h"
+
using namespace llvm;
static Function *CreateFibFunction(Module *M, LLVMContext &Context) {
@@ -41,7 +42,7 @@ static Function *CreateFibFunction(Module *M, LLVMContext &Context) {
Function *FibF =
cast<Function>(M->getOrInsertFunction("fib", Type::getInt32Ty(Context),
Type::getInt32Ty(Context),
- (Type *)0));
+ nullptr));
// Add a basic block to the function.
BasicBlock *BB = BasicBlock::Create(Context, "EntryBlock", FibF);
@@ -87,7 +88,6 @@ static Function *CreateFibFunction(Module *M, LLVMContext &Context) {
return FibF;
}
-
int main(int argc, char **argv) {
int n = argc > 1 ? atol(argv[1]) : 24;
diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp
index 91ea17dd22b..e5fca3fe98d 100644
--- a/examples/HowToUseJIT/HowToUseJIT.cpp
+++ b/examples/HowToUseJIT/HowToUseJIT.cpp
@@ -65,7 +65,7 @@ int main() {
Function *Add1F =
cast<Function>(M->getOrInsertFunction("add1", Type::getInt32Ty(Context),
Type::getInt32Ty(Context),
- (Type *)0));
+ nullptr));
// Add a basic block to the function. As before, it automatically inserts
// because of the last argument.
@@ -91,12 +91,11 @@ int main() {
// Now, function add1 is ready.
-
// Now we're going to create function `foo', which returns an int and takes no
// arguments.
Function *FooF =
cast<Function>(M->getOrInsertFunction("foo", Type::getInt32Ty(Context),
- (Type *)0));
+ nullptr));
// Add a basic block to the FooF function.
BB = BasicBlock::Create(Context, "EntryBlock", FooF);
diff --git a/examples/Kaleidoscope/Chapter2/toy.cpp b/examples/Kaleidoscope/Chapter2/toy.cpp
index 14cba32f5f9..bcba554b246 100644
--- a/examples/Kaleidoscope/Chapter2/toy.cpp
+++ b/examples/Kaleidoscope/Chapter2/toy.cpp
@@ -53,7 +53,7 @@ static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
diff --git a/examples/Kaleidoscope/Chapter3/toy.cpp b/examples/Kaleidoscope/Chapter3/toy.cpp
index 328189c1184..05697ea70a4 100644
--- a/examples/Kaleidoscope/Chapter3/toy.cpp
+++ b/examples/Kaleidoscope/Chapter3/toy.cpp
@@ -8,6 +8,7 @@
#include <map>
#include <string>
#include <vector>
+
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -58,7 +59,7 @@ static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
@@ -193,6 +194,7 @@ std::unique_ptr<ExprAST> Error(const char *Str) {
fprintf(stderr, "Error: %s\n", Str);
return nullptr;
}
+
std::unique_ptr<PrototypeAST> ErrorP(const char *Str) {
Error(Str);
return nullptr;
diff --git a/examples/Kaleidoscope/Chapter4/toy.cpp b/examples/Kaleidoscope/Chapter4/toy.cpp
index 8c96444ad40..4f77ec862b1 100644
--- a/examples/Kaleidoscope/Chapter4/toy.cpp
+++ b/examples/Kaleidoscope/Chapter4/toy.cpp
@@ -65,7 +65,7 @@ static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
@@ -200,6 +200,7 @@ std::unique_ptr<ExprAST> Error(const char *Str) {
fprintf(stderr, "Error: %s\n", Str);
return nullptr;
}
+
std::unique_ptr<PrototypeAST> ErrorP(const char *Str) {
Error(Str);
return nullptr;
diff --git a/examples/Kaleidoscope/Chapter5/toy.cpp b/examples/Kaleidoscope/Chapter5/toy.cpp
index 57edf1aa845..eeca4775eeb 100644
--- a/examples/Kaleidoscope/Chapter5/toy.cpp
+++ b/examples/Kaleidoscope/Chapter5/toy.cpp
@@ -82,7 +82,7 @@ static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
@@ -242,6 +242,7 @@ std::unique_ptr<ExprAST> Error(const char *Str) {
fprintf(stderr, "Error: %s\n", Str);
return nullptr;
}
+
std::unique_ptr<PrototypeAST> ErrorP(const char *Str) {
Error(Str);
return nullptr;
diff --git a/examples/Kaleidoscope/Chapter6/toy.cpp b/examples/Kaleidoscope/Chapter6/toy.cpp
index 0b4ef3dbb98..4d04f7e888a 100644
--- a/examples/Kaleidoscope/Chapter6/toy.cpp
+++ b/examples/Kaleidoscope/Chapter6/toy.cpp
@@ -90,7 +90,7 @@ static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
@@ -275,6 +275,7 @@ std::unique_ptr<ExprAST> Error(const char *Str) {
fprintf(stderr, "Error: %s\n", Str);
return nullptr;
}
+
std::unique_ptr<PrototypeAST> ErrorP(const char *Str) {
Error(Str);
return nullptr;
diff --git a/examples/Kaleidoscope/Chapter7/toy.cpp b/examples/Kaleidoscope/Chapter7/toy.cpp
index cf3fbdf15da..5c0094013d9 100644
--- a/examples/Kaleidoscope/Chapter7/toy.cpp
+++ b/examples/Kaleidoscope/Chapter7/toy.cpp
@@ -95,7 +95,7 @@ static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
@@ -294,6 +294,7 @@ std::unique_ptr<ExprAST> Error(const char *Str) {
fprintf(stderr, "Error: %s\n", Str);
return nullptr;
}
+
std::unique_ptr<PrototypeAST> ErrorP(const char *Str) {
Error(Str);
return nullptr;
@@ -703,7 +704,7 @@ static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
const std::string &VarName) {
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
TheFunction->getEntryBlock().begin());
- return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
+ return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
VarName.c_str());
}
diff --git a/examples/Kaleidoscope/Chapter8/toy.cpp b/examples/Kaleidoscope/Chapter8/toy.cpp
index b78d901db2d..d58dadf08bb 100644
--- a/examples/Kaleidoscope/Chapter8/toy.cpp
+++ b/examples/Kaleidoscope/Chapter8/toy.cpp
@@ -163,7 +163,7 @@ static int gettok() {
LastChar = advance();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
@@ -431,6 +431,7 @@ std::unique_ptr<ExprAST> Error(const char *Str) {
fprintf(stderr, "Error: %s\n", Str);
return nullptr;
}
+
std::unique_ptr<PrototypeAST> ErrorP(const char *Str) {
Error(Str);
return nullptr;
@@ -886,7 +887,7 @@ static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
const std::string &VarName) {
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
TheFunction->getEntryBlock().begin());
- return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
+ return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
VarName.c_str());
}
diff --git a/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp b/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp
index 7e5b38cafe7..667bca46afd 100644
--- a/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp
+++ b/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp
@@ -87,7 +87,7 @@ static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
@@ -387,7 +387,6 @@ static std::unique_ptr<ForExprAST> ParseForExpr() {
return ErrorU<ForExprAST>("expected '=' after for");
getNextToken(); // eat '='.
-
auto Start = ParseExpression();
if (!Start)
return nullptr;
@@ -748,7 +747,7 @@ static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
const std::string &VarName) {
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
TheFunction->getEntryBlock().begin());
- return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
+ return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
VarName.c_str());
}
@@ -760,7 +759,7 @@ Value *VariableExprAST::IRGen(IRGenContext &C) const {
// Look this variable up in the function.
Value *V = C.NamedValues[Name];
- if (V == 0)
+ if (!V)
return ErrorP<Value>("Unknown variable name '" + Name + "'");
// Load the value.
@@ -960,7 +959,7 @@ Value *ForExprAST::IRGen(IRGenContext &C) const {
// Compute the end condition.
Value *EndCond = End->IRGen(C);
- if (EndCond == 0) return EndCond;
+ if (!EndCond) return nullptr;
// Reload, increment, and restore the alloca. This handles the case where
// the body of the loop mutates the variable.
@@ -988,7 +987,6 @@ Value *ForExprAST::IRGen(IRGenContext &C) const {
else
C.NamedValues.erase(VarName);
-
// for expr always returns 0.0.
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
}
@@ -1236,7 +1234,7 @@ private:
RuntimeDyld::SymbolInfo searchFunctionASTs(const std::string &Name) {
auto DefI = FunctionDefs.find(Name);
if (DefI == FunctionDefs.end())
- return 0;
+ return nullptr;
// Return the address of the stub.
// Take the FunctionAST out of the map.
diff --git a/examples/Kaleidoscope/Orc/initial/toy.cpp b/examples/Kaleidoscope/Orc/initial/toy.cpp
index 662c871904c..8dab73bf73a 100644
--- a/examples/Kaleidoscope/Orc/initial/toy.cpp
+++ b/examples/Kaleidoscope/Orc/initial/toy.cpp
@@ -86,7 +86,7 @@ static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
@@ -386,7 +386,6 @@ static std::unique_ptr<ForExprAST> ParseForExpr() {
return ErrorU<ForExprAST>("expected '=' after for");
getNextToken(); // eat '='.
-
auto Start = ParseExpression();
if (!Start)
return nullptr;
@@ -747,7 +746,7 @@ static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
const std::string &VarName) {
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
TheFunction->getEntryBlock().begin());
- return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
+ return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
VarName.c_str());
}
@@ -759,7 +758,7 @@ Value *VariableExprAST::IRGen(IRGenContext &C) const {
// Look this variable up in the function.
Value *V = C.NamedValues[Name];
- if (V == 0)
+ if (!V)
return ErrorP<Value>("Unknown variable name '" + Name + "'");
// Load the value.
@@ -959,7 +958,7 @@ Value *ForExprAST::IRGen(IRGenContext &C) const {
// Compute the end condition.
Value *EndCond = End->IRGen(C);
- if (EndCond == 0) return EndCond;
+ if (!EndCond) return nullptr;
// Reload, increment, and restore the alloca. This handles the case where
// the body of the loop mutates the variable.
@@ -987,7 +986,6 @@ Value *ForExprAST::IRGen(IRGenContext &C) const {
else
C.NamedValues.erase(VarName);
-
// for expr always returns 0.0.
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
}
diff --git a/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp b/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
index fc71849bebb..f5a6c19614b 100644
--- a/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
+++ b/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
@@ -86,7 +86,7 @@ static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
@@ -386,7 +386,6 @@ static std::unique_ptr<ForExprAST> ParseForExpr() {
return ErrorU<ForExprAST>("expected '=' after for");
getNextToken(); // eat '='.
-
auto Start = ParseExpression();
if (!Start)
return nullptr;
@@ -747,7 +746,7 @@ static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
const std::string &VarName) {
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
TheFunction->getEntryBlock().begin());
- return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
+ return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
VarName.c_str());
}
@@ -759,7 +758,7 @@ Value *VariableExprAST::IRGen(IRGenContext &C) const {
// Look this variable up in the function.
Value *V = C.NamedValues[Name];
- if (V == 0)
+ if (!V)
return ErrorP<Value>("Unknown variable name '" + Name + "'");
// Load the value.
@@ -959,7 +958,7 @@ Value *ForExprAST::IRGen(IRGenContext &C) const {
// Compute the end condition.
Value *EndCond = End->IRGen(C);
- if (EndCond == 0) return EndCond;
+ if (!EndCond) return nullptr;
// Reload, increment, and restore the alloca. This handles the case where
// the body of the loop mutates the variable.
@@ -987,7 +986,6 @@ Value *ForExprAST::IRGen(IRGenContext &C) const {
else
C.NamedValues.erase(VarName);
-
// for expr always returns 0.0.
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
}
diff --git a/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp b/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp
index a1779c7e1bf..f9b972e8294 100644
--- a/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp
+++ b/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp
@@ -86,7 +86,7 @@ static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
@@ -386,7 +386,6 @@ static std::unique_ptr<ForExprAST> ParseForExpr() {
return ErrorU<ForExprAST>("expected '=' after for");
getNextToken(); // eat '='.
-
auto Start = ParseExpression();
if (!Start)
return nullptr;
@@ -747,7 +746,7 @@ static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
const std::string &VarName) {
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
TheFunction->getEntryBlock().begin());
- return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
+ return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
VarName.c_str());
}
@@ -759,7 +758,7 @@ Value *VariableExprAST::IRGen(IRGenContext &C) const {
// Look this variable up in the function.
Value *V = C.NamedValues[Name];
- if (V == 0)
+ if (!V)
return ErrorP<Value>("Unknown variable name '" + Name + "'");
// Load the value.
@@ -959,7 +958,7 @@ Value *ForExprAST::IRGen(IRGenContext &C) const {
// Compute the end condition.
Value *EndCond = End->IRGen(C);
- if (EndCond == 0) return EndCond;
+ if (!EndCond) return nullptr;
// Reload, increment, and restore the alloca. This handles the case where
// the body of the loop mutates the variable.
@@ -987,7 +986,6 @@ Value *ForExprAST::IRGen(IRGenContext &C) const {
else
C.NamedValues.erase(VarName);
-
// for expr always returns 0.0.
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
}
@@ -1223,7 +1221,7 @@ private:
RuntimeDyld::SymbolInfo searchFunctionASTs(const std::string &Name) {
auto DefI = FunctionDefs.find(Name);
if (DefI == FunctionDefs.end())
- return 0;
+ return nullptr;
// Take the FunctionAST out of the map.
auto FnAST = std::move(DefI->second);
diff --git a/examples/ParallelJIT/ParallelJIT.cpp b/examples/ParallelJIT/ParallelJIT.cpp
index b2c53a9bb10..27ea8b1419f 100644
--- a/examples/ParallelJIT/ParallelJIT.cpp
+++ b/examples/ParallelJIT/ParallelJIT.cpp
@@ -28,6 +28,7 @@
#include "llvm/Support/TargetSelect.h"
#include <iostream>
#include <pthread.h>
+
using namespace llvm;
static Function* createAdd1(Module *M) {
@@ -38,7 +39,7 @@ static Function* createAdd1(Module *M) {
cast<Function>(M->getOrInsertFunction("add1",
Type::getInt32Ty(M->getContext()),
Type::getInt32Ty(M->getContext()),
- (Type *)0));
+ nullptr));
// Add a basic block to the function. As before, it automatically inserts
// because of the last argument.
@@ -69,7 +70,7 @@ static Function *CreateFibFunction(Module *M) {
cast<Function>(M->getOrInsertFunction("fib",
Type::getInt32Ty(M->getContext()),
Type::getInt32Ty(M->getContext()),
- (Type *)0));
+ nullptr));
// Add a basic block to the function.
BasicBlock *BB = BasicBlock::Create(M->getContext(), "EntryBlock", FibF);
@@ -129,10 +130,10 @@ public:
n = 0;
waitFor = 0;
- int result = pthread_cond_init( &condition, NULL );
+ int result = pthread_cond_init( &condition, nullptr );
assert( result == 0 );
- result = pthread_mutex_init( &mutex, NULL );
+ result = pthread_mutex_init( &mutex, nullptr );
assert( result == 0 );
}
@@ -261,21 +262,21 @@ int main() {
struct threadParams fib2 = { EE, fibF, 42 };
pthread_t add1Thread;
- int result = pthread_create( &add1Thread, NULL, callFunc, &add1 );
+ int result = pthread_create( &add1Thread, nullptr, callFunc, &add1 );
if ( result != 0 ) {
std::cerr << "Could not create thread" << std::endl;
return 1;
}
pthread_t fibThread1;
- result = pthread_create( &fibThread1, NULL, callFunc, &fib1 );
+ result = pthread_create( &fibThread1, nullptr, callFunc, &fib1 );
if ( result != 0 ) {
std::cerr << "Could not create thread" << std::endl;
return 1;
}
pthread_t fibThread2;
- result = pthread_create( &fibThread2, NULL, callFunc, &fib2 );
+ result = pthread_create( &fibThread2, nullptr, callFunc, &fib2 );
if ( result != 0 ) {
std::cerr << "Could not create thread" << std::endl;
return 1;