llvm.org GIT mirror llvm / d16725c
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 Hans Wennborg 4 years ago
27 changed file(s) with 105 addition(s) and 160 deletion(s). Raw diff Collapse all Expand all
2828 #include "llvm/IR/Instructions.h"
2929 #include "llvm/IR/Intrinsics.h"
3030 #include
31
3132 using namespace llvm;
3233
3334 //Set the constants for naming
4344 comflag = cf;
4445
4546 header(Context);
46 readloop(0, 0, 0, Context);
47 readloop(nullptr, nullptr, nullptr, Context);
4748 delete builder;
4849 return module;
4950 }
6667 putchar_func = cast(module->
6768 getOrInsertFunction("putchar", IntegerType::getInt32Ty(C),
6869 IntegerType::getInt32Ty(C), NULL));
69
7070
7171 //Function header
7272
8484 Constant* allocsize = ConstantExpr::getSizeOf(Int8Ty);
8585 allocsize = ConstantExpr::getTruncOrBitCast(allocsize, IntPtrTy);
8686 ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, Int8Ty, allocsize, val_mem,
87 NULL, "arr");
87 nullptr, "arr");
8888 BB->getInstList().push_back(cast(ptr_arr));
8989
9090 //call void @llvm.memset.p0i8.i32(i8 *%arr, i8 0, i32 %d, i32 1, i1 0)
113113 ConstantInt::get(C, APInt(32, memtotal/2)),
114114 headreg);
115115
116
117
118116 //Function footer
119117
120118 //brainf.end:
125123
126124 //ret void
127125 ReturnInst::Create(C, endbb);
128
129
130126
131127 //Error block for array out of bounds
132128 if (comflag & flag_arraybounds)
3232 #include "llvm/IR/Module.h"
3333 #include "llvm/Support/TargetSelect.h"
3434 #include "llvm/Support/raw_ostream.h"
35
3536 using namespace llvm;
3637
3738 static Function *CreateFibFunction(Module *M, LLVMContext &Context) {
4041 Function *FibF =
4142 cast(M->getOrInsertFunction("fib", Type::getInt32Ty(Context),
4243 Type::getInt32Ty(Context),
43 (Type *)0));
44 nullptr));
4445
4546 // Add a basic block to the function.
4647 BasicBlock *BB = BasicBlock::Create(Context, "EntryBlock", FibF);
8586
8687 return FibF;
8788 }
88
8989
9090 int main(int argc, char **argv) {
9191 int n = argc > 1 ? atol(argv[1]) : 24;
6464 Function *Add1F =
6565 cast(M->getOrInsertFunction("add1", Type::getInt32Ty(Context),
6666 Type::getInt32Ty(Context),
67 (Type *)0));
67 nullptr));
6868
6969 // Add a basic block to the function. As before, it automatically inserts
7070 // because of the last argument.
9090
9191 // Now, function add1 is ready.
9292
93
9493 // Now we're going to create function `foo', which returns an int and takes no
9594 // arguments.
9695 Function *FooF =
9796 cast(M->getOrInsertFunction("foo", Type::getInt32Ty(Context),
98 (Type *)0));
97 nullptr));
9998
10099 // Add a basic block to the FooF function.
101100 BB = BasicBlock::Create(Context, "EntryBlock", FooF);
5252 LastChar = getchar();
5353 } while (isdigit(LastChar) || LastChar == '.');
5454
55 NumVal = strtod(NumStr.c_str(), 0);
55 NumVal = strtod(NumStr.c_str(), nullptr);
5656 return tok_number;
5757 }
5858
77 #include
88 #include
99 #include
10
1011 using namespace llvm;
1112
1213 //===----------------------------------------------------------------------===//
5758 LastChar = getchar();
5859 } while (isdigit(LastChar) || LastChar == '.');
5960
60 NumVal = strtod(NumStr.c_str(), 0);
61 NumVal = strtod(NumStr.c_str(), nullptr);
6162 return tok_number;
6263 }
6364
192193 fprintf(stderr, "Error: %s\n", Str);
193194 return nullptr;
194195 }
196
195197 std::unique_ptr ErrorP(const char *Str) {
196198 Error(Str);
197199 return nullptr;
6464 LastChar = getchar();
6565 } while (isdigit(LastChar) || LastChar == '.');
6666
67 NumVal = strtod(NumStr.c_str(), 0);
67 NumVal = strtod(NumStr.c_str(), nullptr);
6868 return tok_number;
6969 }
7070
199199 fprintf(stderr, "Error: %s\n", Str);
200200 return nullptr;
201201 }
202
202203 std::unique_ptr ErrorP(const char *Str) {
203204 Error(Str);
204205 return nullptr;
8181 LastChar = getchar();
8282 } while (isdigit(LastChar) || LastChar == '.');
8383
84 NumVal = strtod(NumStr.c_str(), 0);
84 NumVal = strtod(NumStr.c_str(), nullptr);
8585 return tok_number;
8686 }
8787
241241 fprintf(stderr, "Error: %s\n", Str);
242242 return nullptr;
243243 }
244
244245 std::unique_ptr ErrorP(const char *Str) {
245246 Error(Str);
246247 return nullptr;
8989 LastChar = getchar();
9090 } while (isdigit(LastChar) || LastChar == '.');
9191
92 NumVal = strtod(NumStr.c_str(), 0);
92 NumVal = strtod(NumStr.c_str(), nullptr);
9393 return tok_number;
9494 }
9595
274274 fprintf(stderr, "Error: %s\n", Str);
275275 return nullptr;
276276 }
277
277278 std::unique_ptr ErrorP(const char *Str) {
278279 Error(Str);
279280 return nullptr;
9494 LastChar = getchar();
9595 } while (isdigit(LastChar) || LastChar == '.');
9696
97 NumVal = strtod(NumStr.c_str(), 0);
97 NumVal = strtod(NumStr.c_str(), nullptr);
9898 return tok_number;
9999 }
100100
293293 fprintf(stderr, "Error: %s\n", Str);
294294 return nullptr;
295295 }
296
296297 std::unique_ptr ErrorP(const char *Str) {
297298 Error(Str);
298299 return nullptr;
702703 const std::string &VarName) {
703704 IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
704705 TheFunction->getEntryBlock().begin());
705 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
706 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
706707 VarName.c_str());
707708 }
708709
162162 LastChar = advance();
163163 } while (isdigit(LastChar) || LastChar == '.');
164164
165 NumVal = strtod(NumStr.c_str(), 0);
165 NumVal = strtod(NumStr.c_str(), nullptr);
166166 return tok_number;
167167 }
168168
430430 fprintf(stderr, "Error: %s\n", Str);
431431 return nullptr;
432432 }
433
433434 std::unique_ptr ErrorP(const char *Str) {
434435 Error(Str);
435436 return nullptr;
885886 const std::string &VarName) {
886887 IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
887888 TheFunction->getEntryBlock().begin());
888 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
889 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
889890 VarName.c_str());
890891 }
891892
8686 LastChar = getchar();
8787 } while (isdigit(LastChar) || LastChar == '.');
8888
89 NumVal = strtod(NumStr.c_str(), 0);
89 NumVal = strtod(NumStr.c_str(), nullptr);
9090 return tok_number;
9191 }
9292
385385 if (CurTok != '=')
386386 return ErrorU("expected '=' after for");
387387 getNextToken(); // eat '='.
388
389388
390389 auto Start = ParseExpression();
391390 if (!Start)
747746 const std::string &VarName) {
748747 IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
749748 TheFunction->getEntryBlock().begin());
750 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
749 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
751750 VarName.c_str());
752751 }
753752
759758 // Look this variable up in the function.
760759 Value *V = C.NamedValues[Name];
761760
762 if (V == 0)
761 if (!V)
763762 return ErrorP("Unknown variable name '" + Name + "'");
764763
765764 // Load the value.
959958
960959 // Compute the end condition.
961960 Value *EndCond = End->IRGen(C);
962 if (EndCond == 0) return EndCond;
961 if (!EndCond) return nullptr;
963962
964963 // Reload, increment, and restore the alloca. This handles the case where
965964 // the body of the loop mutates the variable.
986985 C.NamedValues[VarName] = OldVal;
987986 else
988987 C.NamedValues.erase(VarName);
989
990988
991989 // for expr always returns 0.0.
992990 return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
12351233 RuntimeDyld::SymbolInfo searchFunctionASTs(const std::string &Name) {
12361234 auto DefI = FunctionDefs.find(Name);
12371235 if (DefI == FunctionDefs.end())
1238 return 0;
1236 return nullptr;
12391237
12401238 // Return the address of the stub.
12411239 // Take the FunctionAST out of the map.
8585 LastChar = getchar();
8686 } while (isdigit(LastChar) || LastChar == '.');
8787
88 NumVal = strtod(NumStr.c_str(), 0);
88 NumVal = strtod(NumStr.c_str(), nullptr);
8989 return tok_number;
9090 }
9191
384384 if (CurTok != '=')
385385 return ErrorU("expected '=' after for");
386386 getNextToken(); // eat '='.
387
388387
389388 auto Start = ParseExpression();
390389 if (!Start)
746745 const std::string &VarName) {
747746 IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
748747 TheFunction->getEntryBlock().begin());
749 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
748 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
750749 VarName.c_str());
751750 }
752751
758757 // Look this variable up in the function.
759758 Value *V = C.NamedValues[Name];
760759
761 if (V == 0)
760 if (!V)
762761 return ErrorP("Unknown variable name '" + Name + "'");
763762
764763 // Load the value.
958957
959958 // Compute the end condition.
960959 Value *EndCond = End->IRGen(C);
961 if (EndCond == 0) return EndCond;
960 if (!EndCond) return nullptr;
962961
963962 // Reload, increment, and restore the alloca. This handles the case where
964963 // the body of the loop mutates the variable.
985984 C.NamedValues[VarName] = OldVal;
986985 else
987986 C.NamedValues.erase(VarName);
988
989987
990988 // for expr always returns 0.0.
991989 return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
8585 LastChar = getchar();
8686 } while (isdigit(LastChar) || LastChar == '.');
8787
88 NumVal = strtod(NumStr.c_str(), 0);
88 NumVal = strtod(NumStr.c_str(), nullptr);
8989 return tok_number;
9090 }
9191
384384 if (CurTok != '=')
385385 return ErrorU("expected '=' after for");
386386 getNextToken(); // eat '='.
387
388387
389388 auto Start = ParseExpression();
390389 if (!Start)
746745 const std::string &VarName) {
747746 IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
748747 TheFunction->getEntryBlock().begin());
749 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
748 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
750749 VarName.c_str());
751750 }
752751
758757 // Look this variable up in the function.
759758 Value *V = C.NamedValues[Name];
760759
761 if (V == 0)
760 if (!V)
762761 return ErrorP("Unknown variable name '" + Name + "'");
763762
764763 // Load the value.
958957
959958 // Compute the end condition.
960959 Value *EndCond = End->IRGen(C);
961 if (EndCond == 0) return EndCond;
960 if (!EndCond) return nullptr;
962961
963962 // Reload, increment, and restore the alloca. This handles the case where
964963 // the body of the loop mutates the variable.
985984 C.NamedValues[VarName] = OldVal;
986985 else
987986 C.NamedValues.erase(VarName);
988
989987
990988 // for expr always returns 0.0.
991989 return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
8585 LastChar = getchar();
8686 } while (isdigit(LastChar) || LastChar == '.');
8787
88 NumVal = strtod(NumStr.c_str(), 0);
88 NumVal = strtod(NumStr.c_str(), nullptr);
8989 return tok_number;
9090 }
9191
384384 if (CurTok != '=')
385385 return ErrorU("expected '=' after for");
386386 getNextToken(); // eat '='.
387
388387
389388 auto Start = ParseExpression();
390389 if (!Start)
746745 const std::string &VarName) {
747746 IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
748747 TheFunction->getEntryBlock().begin());
749 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
748 return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr,
750749 VarName.c_str());
751750 }
752751
758757 // Look this variable up in the function.
759758 Value *V = C.NamedValues[Name];
760759
761 if (V == 0)
760 if (!V)
762761 return ErrorP("Unknown variable name '" + Name + "'");
763762
764763 // Load the value.
958957
959958 // Compute the end condition.
960959 Value *EndCond = End->IRGen(C);
961 if (EndCond == 0) return EndCond;
960 if (!EndCond) return nullptr;
962961
963962 // Reload, increment, and restore the alloca. This handles the case where
964963 // the body of the loop mutates the variable.
985984 C.NamedValues[VarName] = OldVal;
986985 else
987986 C.NamedValues.erase(VarName);
988
989987
990988 // for expr always returns 0.0.
991989 return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
12221220 RuntimeDyld::SymbolInfo searchFunctionASTs(const std::string &Name) {
12231221 auto DefI = FunctionDefs.find(Name);
12241222 if (DefI == FunctionDefs.end())
1225 return 0;
1223 return nullptr;
12261224
12271225 // Take the FunctionAST out of the map.
12281226 auto FnAST = std::move(DefI->second);
2727 #include "llvm/Support/TargetSelect.h"
2828 #include
2929 #include
30
3031 using namespace llvm;
3132
3233 static Function* createAdd1(Module *M) {
3738 cast(M->getOrInsertFunction("add1",
3839 Type::getInt32Ty(M->getContext()),
3940 Type::getInt32Ty(M->getContext()),
40 (Type *)0));
41 nullptr));
4142
4243 // Add a basic block to the function. As before, it automatically inserts
4344 // because of the last argument.
6869 cast(M->getOrInsertFunction("fib",
6970 Type::getInt32Ty(M->getContext()),
7071 Type::getInt32Ty(M->getContext()),
71 (Type *)0));
72 nullptr));
7273
7374 // Add a basic block to the function.
7475 BasicBlock *BB = BasicBlock::Create(M->getContext(), "EntryBlock", FibF);
128129 n = 0;
129130 waitFor = 0;
130131
131 int result = pthread_cond_init( &condition, NULL );
132 assert( result == 0 );
133
134 result = pthread_mutex_init( &mutex, NULL );
132 int result = pthread_cond_init( &condition, nullptr );
133 assert( result == 0 );
134
135 result = pthread_mutex_init( &mutex, nullptr );
135136 assert( result == 0 );
136137 }
137138
260261 struct threadParams fib2 = { EE, fibF, 42 };
261262
262263 pthread_t add1Thread;
263 int result = pthread_create( &add1Thread, NULL, callFunc, &add1 );
264 int result = pthread_create( &add1Thread, nullptr, callFunc, &add1 );
264265 if ( result != 0 ) {
265266 std::cerr << "Could not create thread" << std::endl;
266267 return 1;
267268 }
268269
269270 pthread_t fibThread1;
270 result = pthread_create( &fibThread1, NULL, callFunc, &fib1 );
271 result = pthread_create( &fibThread1, nullptr, callFunc, &fib1 );
271272 if ( result != 0 ) {
272273 std::cerr << "Could not create thread" << std::endl;
273274 return 1;
274275 }
275276
276277 pthread_t fibThread2;
277 result = pthread_create( &fibThread2, NULL, callFunc, &fib2 );
278 result = pthread_create( &fibThread2, nullptr, callFunc, &fib2 );
278279 if ( result != 0 ) {
279280 std::cerr << "Could not create thread" << std::endl;
280281 return 1;
2727 T Head;
2828 const ImmutableListImpl* Tail;
2929
30 ImmutableListImpl(const T& head, const ImmutableListImpl* tail = 0)
30 ImmutableListImpl(const T& head, const ImmutableListImpl* tail = nullptr)
3131 : Head(head), Tail(tail) {}
3232
3333 friend class ImmutableListFactory;
7171 // This constructor should normally only be called by ImmutableListFactory.
7272 // There may be cases, however, when one needs to extract the internal pointer
7373 // and reconstruct a list object from that pointer.
74 ImmutableList(const ImmutableListImpl* x = 0) : X(x) {}
74 ImmutableList(const ImmutableListImpl* x = nullptr) : X(x) {}
7575
7676 const ImmutableListImpl* getInternalPointer() const {
7777 return X;
8080 class iterator {
8181 const ImmutableListImpl* L;
8282 public:
83 iterator() : L(0) {}
83 iterator() : L(nullptr) {}
8484 iterator(ImmutableList l) : L(l.getInternalPointer()) {}
8585
8686 iterator& operator++() { L = L->getTail(); return *this; }
127127 /// getTail - Returns the tail of the list, which is another (possibly empty)
128128 /// ImmutableList.
129129 ImmutableList getTail() {
130 return X ? X->getTail() : 0;
130 return X ? X->getTail() : nullptr;
131131 }
132132
133133 void Profile(FoldingSetNodeID& ID) const {
189189 }
190190
191191 ImmutableList getEmptyList() const {
192 return ImmutableList(0);
192 return ImmutableList(nullptr);
193193 }
194194
195195 ImmutableList create(const T& X) {
225225
226226 } // end llvm namespace
227227
228 #endif
228 #endif // LLVM_ADT_IMMUTABLELIST_H
7777 explicit ImmutableMap(const TreeTy* R) : Root(const_cast(R)) {
7878 if (Root) { Root->retain(); }
7979 }
80
8081 ImmutableMap(const ImmutableMap &X) : Root(X.Root) {
8182 if (Root) { Root->retain(); }
8283 }
84
8385 ImmutableMap &operator=(const ImmutableMap &X) {
8486 if (Root != X.Root) {
8587 if (X.Root) { X.Root->retain(); }
8890 }
8991 return *this;
9092 }
93
9194 ~ImmutableMap() {
9295 if (Root) { Root->release(); }
9396 }
376379 if (T) return &T->getValue().second;
377380 }
378381
379 return 0;
382 return nullptr;
380383 }
381384
382385 /// getMaxElement - Returns the pair in the ImmutableMap for
401404
402405 } // end namespace llvm
403406
404 #endif
407 #endif // LLVM_ADT_IMMUTABLEMAP_H
153153
154154 template
155155 IntrusiveRefCntPtr(IntrusiveRefCntPtr&& S) : Obj(S.get()) {
156 S.Obj = 0;
156 S.Obj = nullptr;
157157 }
158158
159159 template
189189 }
190190
191191 void resetWithoutRelease() {
192 Obj = 0;
192 Obj = nullptr;
193193 }
194194
195195 private:
3838 /// etc) do not perform as well in practice as a linked list with this iterator
3939 /// kept up to date. They are also significantly more memory intensive.
4040
41
4241 template
4342 struct SparseBitVectorElement
4443 : public ilist_node > {
203202 BecameZero = allzero;
204203 return changed;
205204 }
205
206206 // Intersect this Element with the complement of RHS and return true if this
207207 // one changed. BecameZero is set to true if this element became all-zero
208208 // bits.
225225 BecameZero = allzero;
226226 return changed;
227227 }
228
228229 // Three argument version of intersectWithComplement that intersects
229230 // RHS1 & ~RHS2 into this element
230231 void intersectWithComplement(const SparseBitVectorElement &RHS1,
407408 // bitmap.
408409 return AtEnd == RHS.AtEnd && RHS.BitNumber == BitNumber;
409410 }
411
410412 bool operator!=(const SparseBitVectorIterator &RHS) const {
411413 return !(*this == RHS);
412414 }
413 SparseBitVectorIterator(): BitVector(NULL) {
414 }
415
415
416 SparseBitVectorIterator(): BitVector(nullptr) {
417 }
416418
417419 SparseBitVectorIterator(const SparseBitVector *RHS,
418420 bool end = false):BitVector(RHS) {
688690 bool intersectWithComplement(const SparseBitVector *RHS) const {
689691 return intersectWithComplement(*RHS);
690692 }
691
692693
693694 // Three argument version of intersectWithComplement.
694695 // Result of RHS1 & ~RHS2 is stored into this bitmap.
748749 Elements.push_back(NewElement);
749750 ++Iter1;
750751 }
751
752 return;
753752 }
754753
755754 void intersectWithComplement(const SparseBitVector *RHS1,
884883 return Result;
885884 }
886885
887
888
889
890886 // Dump a SparseBitVector to a stream
891887 template
892888 void dump(const SparseBitVector &LHS, raw_ostream &out) {
904900 }
905901 } // end namespace llvm
906902
907 #endif
903 #endif // LLVM_ADT_SPARSEBITVECTOR_H
425425
426426 /// \brief Create a call to Masked Load intrinsic
427427 CallInst *CreateMaskedLoad(Value *Ptr, unsigned Align, Value *Mask,
428 Value *PassThru = 0, const Twine &Name = "");
428 Value *PassThru = nullptr, const Twine &Name = "");
429429
430430 /// \brief Create a call to Masked Store intrinsic
431431 CallInst *CreateMaskedStore(Value *Val, Value *Ptr, unsigned Align,
17441744
17451745 // Create wrappers for C Binding types (see CBindingWrapping.h).
17461746 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder<>, LLVMBuilderRef)
1747 }
1748
1749 #endif
1747
1748 } // end namespace llvm
1749
1750 #endif // LLVM_IR_IRBUILDER_H
686686 Value *S, ///< The pointer value to be casted (operand 0)
687687 Type *Ty, ///< The type to which cast should be made
688688 const Twine &Name = "", ///< Name for the instruction
689 Instruction *InsertBefore = 0 ///< Place to insert the instruction
689 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
690690 );
691691
692692 /// @brief Create a BitCast, a PtrToInt, or an IntToPTr cast instruction.
699699 Value *S, ///< The pointer value to be casted (operand 0)
700700 Type *Ty, ///< The type to which cast should be made
701701 const Twine &Name = "", ///< Name for the instruction
702 Instruction *InsertBefore = 0 ///< Place to insert the instruction
702 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
703703 );
704704
705705 /// @brief Create a ZExt, BitCast, or Trunc for int -> int casts.
13201320 }
13211321 };
13221322
1323 } // End llvm namespace
1324
1325 #endif
1323 } // end llvm namespace
1324
1325 #endif // LLVM_IR_INSTRTYPES_H
572572 template<>
573573 struct DenseMapInfo {
574574 static inline AAMDNodes getEmptyKey() {
575 return AAMDNodes(DenseMapInfo::getEmptyKey(), 0, 0);
575 return AAMDNodes(DenseMapInfo::getEmptyKey(),
576 nullptr, nullptr);
576577 }
577578 static inline AAMDNodes getTombstoneKey() {
578 return AAMDNodes(DenseMapInfo::getTombstoneKey(), 0, 0);
579 return AAMDNodes(DenseMapInfo::getTombstoneKey(),
580 nullptr, nullptr);
579581 }
580582 static unsigned getHashValue(const AAMDNodes &Val) {
581583 return DenseMapInfo::getHashValue(Val.TBAA) ^
12181220
12191221 } // end llvm namespace
12201222
1221 #endif
1223 #endif // LLVM_IR_METADATA_H
3333 UseListOrder(const Value *V, const Function *F, size_t ShuffleSize)
3434 : V(V), F(F), Shuffle(ShuffleSize) {}
3535
36 UseListOrder() : V(0), F(0) {}
36 UseListOrder() : V(nullptr), F(nullptr) {}
3737 UseListOrder(UseListOrder &&X)
3838 : V(X.V), F(X.F), Shuffle(std::move(X.Shuffle)) {}
3939 UseListOrder &operator=(UseListOrder &&X) {
5252
5353 } // end namespace llvm
5454
55 #endif
55 #endif // LLVM_IR_USELISTORDER_H
136136 if (CrashRecoveryContext *context = CrashRecoveryContext::GetCurrent())
137137 return new DERIVED(context, x);
138138 }
139 return 0;
139 return nullptr;
140140 }
141141 };
142142
194194 void unregister() {
195195 if (cleanup && !cleanup->cleanupFired)
196196 cleanup->getContext()->unregisterCleanup(cleanup);
197 cleanup = 0;
198 }
199 };
200 }
201
202 #endif
197 cleanup = nullptr;
198 }
199 };
200 } // end namespace llvm
201
202 #endif // LLVM_SUPPORT_CRASHRECOVERYCONTEXT_H
3636 std::unique_ptr instantiate() const { return Ctor(); }
3737 };
3838
39
4039 /// Traits for registry entries. If using other than SimpleRegistryEntry, it
4140 /// is necessary to define an alternate traits class.
4241 template
5251 static const char *descof(const entry &Entry) { return Entry.getDesc(); }
5352 };
5453
55
5654 /// A global registry used in conjunction with static constructors to make
5755 /// pluggable components (like targets or garbage collectors) "just work" when
5856 /// linked with an executable.
10199 }
102100 };
103101
104
105102 /// Iterators for registry entries.
106103 ///
107104 class iterator {
123120 static iterator_range entries() {
124121 return iterator_range(begin(), end());
125122 }
126
127123
128124 /// Abstract base class for registry listeners, which are informed when new
129125 /// entries are added to the registry. Simply subclass and instantiate:
159155 }
160156
161157 public:
162 listener() : Prev(ListenerTail), Next(0) {
158 listener() : Prev(ListenerTail), Next(nullptr) {
163159 if (Prev)
164160 Prev->Next = this;
165161 else
178174 ListenerHead = Next;
179175 }
180176 };
181
182177
183178 /// A static registration template. Use like such:
184179 ///
209204 };
210205
211206 /// Registry::Parser now lives in llvm/Support/RegistryParser.h.
212
213207 };
214208
215209 // Since these are defined in a header file, plugins must be sure to export
227221 template
228222 typename Registry::listener *Registry::ListenerTail;
229223
230 }
231
232 #endif
224 } // end namespace llvm
225
226 #endif // LLVM_SUPPORT_REGISTRY_H
88
99 #ifndef LLVM_SUPPORT_YAMLTRAITS_H
1010 #define LLVM_SUPPORT_YAMLTRAITS_H
11
1211
1312 #include "llvm/ADT/DenseMap.h"
1413 #include "llvm/ADT/DenseMapInfo.h"
2726
2827 namespace llvm {
2928 namespace yaml {
30
3129
3230 /// This class should be specialized by any type that needs to be converted
3331 /// to/from a YAML mapping. For example:
5149 // static const bool flow = true;
5250 };
5351
54
5552 /// This class should be specialized by any integral type that converts
5653 /// to/from a YAML scalar where there is a one-to-one mapping between
5754 /// in-memory values and a string in YAML. For example:
6966 // static void enumeration(IO &io, T &value);
7067 };
7168
72
7369 /// This class should be specialized by any integer type that is a union
7470 /// of bit values and the YAML representation is a flow sequence of
7571 /// strings. For example:
8682 // Must provide:
8783 // static void bitset(IO &io, T &value);
8884 };
89
9085
9186 /// This class should be specialized by type that requires custom conversion
9287 /// to/from a yaml scalar. For example:
148143 // static StringRef input(StringRef Scalar, void *ctxt, T &Value);
149144 };
150145
151
152146 /// This class should be specialized by any type that needs to be converted
153147 /// to/from a YAML sequence. For example:
154148 ///
174168 // static const bool flow = true;
175169 };
176170
177
178171 /// This class should be specialized by any type that needs to be converted
179172 /// to/from a list of YAML documents.
180173 template
184177 // static T::value_type& element(IO &io, T &seq, size_t index);
185178 };
186179
187
188180 // Only used by compiler if both template types are the same
189181 template
190182 struct SameType;
192184 // Only used for better diagnostics of missing traits
193185 template
194186 struct MissingTrait;
195
196
197187
198188 // Test if ScalarEnumerationTraits is defined on type T.
199189 template
212202 (sizeof(test >(nullptr)) == 1);
213203 };
214204
215
216205 // Test if ScalarBitSetTraits is defined on type T.
217206 template
218207 struct has_ScalarBitSetTraits
228217 public:
229218 static bool const value = (sizeof(test >(nullptr)) == 1);
230219 };
231
232220
233221 // Test if ScalarTraits is defined on type T.
234222 template
251239 (sizeof(test>(nullptr, nullptr, nullptr)) == 1);
252240 };
253241
254
255242 // Test if BlockScalarTraits is defined on type T.
256243 template
257244 struct has_BlockScalarTraits
271258 (sizeof(test>(nullptr, nullptr)) == 1);
272259 };
273260
274
275261 // Test if MappingTraits is defined on type T.
276262 template
277263 struct has_MappingTraits
304290 static bool const value = (sizeof(test >(nullptr)) == 1);
305291 };
306292
307
308
309293 // Test if SequenceTraits is defined on type T.
310294 template
311295 struct has_SequenceMethodTraits
321305 public:
322306 static bool const value = (sizeof(test >(nullptr)) == 1);
323307 };
324
325308
326309 // has_FlowTraits will cause an error with some compilers because
327310 // it subclasses int. Using this wrapper only instantiates the
352335 static bool const value = sizeof(f(nullptr)) == 2;
353336 };
354337
355
356
357338 // Test if SequenceTraits is defined on type T
358339 template
359340 struct has_SequenceTraits : public std::integral_constant
360341 has_SequenceMethodTraits::value > { };
361
362342
363343 // Test if DocumentListTraits is defined on type T
364344 template
451431
452432 return false;
453433 }
454
455434
456435 template
457436 struct missingTraits : public std::integral_constant
653632 void *Ctxt;
654633 };
655634
656
657
658635 template
659636 typename std::enable_if::value,void>::type
660637 yamlize(IO &io, T &Val, bool) {
674651 io.endBitSetScalar();
675652 }
676653 }
677
678654
679655 template
680656 typename std::enable_if::value,void>::type
790766 }
791767 }
792768
793
794769 template<>
795770 struct ScalarTraits {
796771 static void output(const bool &, void*, llvm::raw_ostream &);
881856 static StringRef input(StringRef, void*, double &);
882857 static bool mustQuote(StringRef) { return false; }
883858 };
884
885
886859
887860 // Utility for use within MappingTraits<>::mapping() method
888861 // to [de]normalize an object for use with YAML conversion.
916889 TFinal &Result;
917890 };
918891
919
920
921892 // Utility for use within MappingTraits<>::mapping() method
922893 // to [de]normalize an object for use with YAML conversion.
923894 template
924895 struct MappingNormalizationHeap {
925896 MappingNormalizationHeap(IO &i_o, TFinal &Obj)
926 : io(i_o), BufPtr(NULL), Result(Obj) {
897 : io(i_o), BufPtr(nullptr), Result(Obj) {
927898 if ( io.outputting() ) {
928899 BufPtr = new (&Buffer) TNorm(io, Obj);
929900 }
951922 TNorm *BufPtr;
952923 TFinal &Result;
953924 };
954
955
956925
957926 ///
958927 /// The Input class is used to parse a yaml document into in-memory structs
10821051 void setError(HNode *hnode, const Twine &message);
10831052 void setError(Node *node, const Twine &message);
10841053
1085
10861054 public:
10871055 // These are only used by operator>>. They could be private
10881056 // if those templated things could be made friends.
11031071 HNode *CurrentNode;
11041072 bool ScalarMatchFound;
11051073 };
1106
1107
1108
11091074
11101075 ///
11111076 /// The Output class is used to generate a yaml document from in-memory structs
11801145 bool NeedsNewLine;
11811146 };
11821147
1183
1184
1185
11861148 /// YAML I/O does conversion based on types. But often native data types
11871149 /// are just a typedef of built in intergral types (e.g. int). But the C++
11881150 /// type matching system sees through the typedef and all the typedefed types
12051167 _base value; \
12061168 };
12071169
1208
1209
12101170 ///
12111171 /// Use these types instead of uintXX_t in any mapping to have
12121172 /// its yaml output formatted as hexadecimal.
12161176 LLVM_YAML_STRONG_TYPEDEF(uint32_t, Hex32)
12171177 LLVM_YAML_STRONG_TYPEDEF(uint64_t, Hex64)
12181178
1219
12201179 template<>
12211180 struct ScalarTraits {
12221181 static void output(const Hex8 &, void*, llvm::raw_ostream &);
12441203 static StringRef input(StringRef, void*, Hex64 &);
12451204 static bool mustQuote(StringRef) { return false; }
12461205 };
1247
12481206
12491207 // Define non-member operator>> so that Input can stream in a document list.
12501208 template
13021260 return yin;
13031261 }
13041262
1305
13061263 // Define non-member operator<< so that Output can stream out document list.
13071264 template
13081265 inline
13711328 return yout;
13721329 }
13731330
1374
13751331 } // namespace yaml
13761332 } // namespace llvm
1377
13781333
13791334 /// Utility for declaring that a std::vector of a particular type
13801335 /// should be considered a YAML sequence.
14351390 } \
14361391 }
14371392
1438
1439
14401393 #endif // LLVM_SUPPORT_YAMLTRAITS_H
132132 static cl::list
133133 ArchFlags("arch", cl::desc("architecture(s) from a Mach-O file to dump"),
134134 cl::ZeroOrMore);
135
135136 bool ArchAll = false;
136137
137138 static std::string ThumbTripleName;
44594460 bool is_meta_class;
44604461 print_class_ro64_t((c.data + n_value) & ~0x7, info, is_meta_class);
44614462
4462 if (is_meta_class == false) {
4463 if (!is_meta_class) {
44634464 outs() << "Meta Class\n";
44644465 print_class64_t(c.isa + isa_n_value, info);
44654466 }
45244525 bool is_meta_class;
45254526 print_class_ro32_t(c.data & ~0x3, info, is_meta_class);
45264527
4527 if (is_meta_class == false) {
4528 if (!is_meta_class) {
45284529 outs() << "Meta Class\n";
45294530 print_class32_t(c.isa, info);
45304531 }
48324833 outs() << " name " << format("0x%" PRIx32, c.name);
48334834 name = get_symbol_32(offset + offsetof(struct category32_t, name), S, info,
48344835 c.name);
4835 if (name != NULL)
4836 if (name)
48364837 outs() << " " << name;
48374838 outs() << "\n";
48384839
55265527 // binary for the iOS simulator which is the second Objective-C
55275528 // ABI. In that case printObjc1_32bit_MetaData() will determine that
55285529 // and return false.
5529 if (printObjc1_32bit_MetaData(O, verbose) == false)
5530 if (!printObjc1_32bit_MetaData(O, verbose))
55305531 printObjc2_32bit_MetaData(O, verbose);
55315532 }
55325533 }