llvm.org GIT mirror llvm / 573faec
[C++] Use 'nullptr'. Tools edition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207176 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 5 years ago
36 changed file(s) with 179 addition(s) and 177 deletion(s). Raw diff Collapse all Expand all
6969 unsigned timeout, unsigned memlimit, bool use_valgrind,
7070 LLVMContext& ctxt)
7171 : Context(ctxt), ToolName(toolname), ReferenceOutputFile(OutputFile),
72 Program(0), Interpreter(0), SafeInterpreter(0), gcc(0),
73 run_find_bugs(find_bugs), Timeout(timeout),
72 Program(nullptr), Interpreter(nullptr), SafeInterpreter(nullptr),
73 gcc(nullptr), run_find_bugs(find_bugs), Timeout(timeout),
7474 MemoryLimit(memlimit), UseValgrind(use_valgrind) {}
7575
7676 BugDriver::~BugDriver() {
116116
117117 // Load the first input file.
118118 Program = ParseInputFile(Filenames[0], Context);
119 if (Program == 0) return true;
119 if (!Program) return true;
120120
121121 outs() << "Read input file : '" << Filenames[0] << "'\n";
122122
123123 for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
124124 std::unique_ptr M(ParseInputFile(Filenames[i], Context));
125 if (M.get() == 0) return true;
125 if (!M.get()) return true;
126126
127127 outs() << "Linking in input file: '" << Filenames[i] << "'\n";
128128 std::string ErrorMessage;
6262 std::vector &Suffix,
6363 std::string &Error) {
6464 std::string PrefixOutput;
65 Module *OrigProgram = 0;
65 Module *OrigProgram = nullptr;
6666 if (!Prefix.empty()) {
6767 outs() << "Checking to see if these passes crash: "
6868 << getPassesString(Prefix) << ": ";
7272 OrigProgram = BD.Program;
7373
7474 BD.Program = ParseInputFile(PrefixOutput, BD.getContext());
75 if (BD.Program == 0) {
75 if (BD.Program == nullptr) {
7676 errs() << BD.getToolName() << ": Error reading bitcode file '"
7777 << PrefixOutput << "'!\n";
7878 exit(1);
148148 for (Module::global_iterator I = M->global_begin(), E = M->global_end();
149149 I != E; ++I)
150150 if (I->hasInitializer() && !GVSet.count(I)) {
151 I->setInitializer(0);
151 I->setInitializer(nullptr);
152152 I->setLinkage(GlobalValue::ExternalLinkage);
153153 }
154154
446446 for (Module::global_iterator I = M->global_begin(), E = M->global_end();
447447 I != E; ++I)
448448 if (I->hasInitializer()) {
449 I->setInitializer(0);
449 I->setInitializer(nullptr);
450450 I->setLinkage(GlobalValue::ExternalLinkage);
451451 DeletedInit = true;
452452 }
144144
145145 // Create an instance of the AbstractInterpreter interface as specified on
146146 // the command line
147 SafeInterpreter = 0;
147 SafeInterpreter = nullptr;
148148 std::string Message;
149149
150150 switch (InterpreterSel) {
255255 if (!gcc) { outs() << Message << "\nExiting.\n"; exit(1); }
256256
257257 // If there was an error creating the selected interpreter, quit with error.
258 return Interpreter == 0;
258 return Interpreter == nullptr;
259259 }
260260
261261 /// compileProgram - Try to compile the specified module, returning false and
297297 const std::string &SharedObj,
298298 AbstractInterpreter *AI,
299299 std::string *Error) const {
300 if (AI == 0) AI = Interpreter;
300 if (!AI) AI = Interpreter;
301301 assert(AI && "Interpreter should have been created already!");
302302 bool CreatedBitcode = false;
303303 if (BitcodeFile.empty()) {
444444 std::string *ErrMsg) const {
445445 // Execute the program, generating an output file...
446446 std::string Output(
447 executeProgram(Program, "", BitcodeFile, SharedObject, 0, ErrMsg));
447 executeProgram(Program, "", BitcodeFile, SharedObject, nullptr, ErrMsg));
448448 if (!ErrMsg->empty())
449449 return false;
450450
5050
5151 Function* globalInitUsesExternalBA(GlobalVariable* GV) {
5252 if (!GV->hasInitializer())
53 return 0;
53 return nullptr;
5454
5555 Constant *I = GV->getInitializer();
5656
7777 Todo.push_back(C);
7878 }
7979 }
80 return 0;
80 return nullptr;
8181 }
8282 } // end anonymous namespace
8383
149149 CleanupPasses.push_back("deadargelim");
150150
151151 Module *New = runPassesOn(M, CleanupPasses);
152 if (New == 0) {
152 if (!New) {
153153 errs() << "Final cleanups failed. Sorry. :( Please report a bug!\n";
154154 return M;
155155 }
166166 LoopExtractPasses.push_back("loop-extract-single");
167167
168168 Module *NewM = runPassesOn(M, LoopExtractPasses);
169 if (NewM == 0) {
169 if (!NewM) {
170170 outs() << "*** Loop extraction failed: ";
171171 EmitProgressBitcode(M, "loopextraction", true);
172172 outs() << "*** Sorry. :( Please report a bug!\n";
173 return 0;
173 return nullptr;
174174 }
175175
176176 // Check to see if we created any new functions. If not, no loops were
179179 static unsigned NumExtracted = 32;
180180 if (M->size() == NewM->size() || --NumExtracted == 0) {
181181 delete NewM;
182 return 0;
182 return nullptr;
183183 } else {
184184 assert(M->size() < NewM->size() && "Loop extract removed functions?");
185185 Module::iterator MI = NewM->begin();
336336 << "' and from test function '" << TestFn->getName() << "'.\n";
337337 exit(1);
338338 }
339 I->setInitializer(0); // Delete the initializer to make it external
339 I->setInitializer(nullptr); // Delete the initializer to make it external
340340 } else {
341341 // If we keep it in the safe module, then delete it in the test module
342 GV->setInitializer(0);
342 GV->setInitializer(nullptr);
343343 }
344344 }
345345
371371 outs() << "*** Basic Block extraction failed!\n";
372372 errs() << "Error creating temporary file: " << EC.message() << "\n";
373373 EmitProgressBitcode(M, "basicblockextractfail", true);
374 return 0;
374 return nullptr;
375375 }
376376 sys::RemoveFileOnSignal(Filename);
377377
390390 errs() << "Error writing list of blocks to not extract\n";
391391 EmitProgressBitcode(M, "basicblockextractfail", true);
392392 BlocksToNotExtractFile.os().clear_error();
393 return 0;
393 return nullptr;
394394 }
395395 BlocksToNotExtractFile.keep();
396396
404404
405405 sys::fs::remove(Filename.c_str());
406406
407 if (Ret == 0) {
407 if (!Ret) {
408408 outs() << "*** Basic Block extraction failed, please report a bug!\n";
409409 EmitProgressBitcode(M, "basicblockextractfail", true);
410410 }
4444 return false;
4545 }
4646
47 srand(time(NULL));
47 srand(time(nullptr));
4848
4949 unsigned num = 1;
5050 while(1) {
234234 if (!Error.empty()) {
235235 // Delete the linked module
236236 delete M1;
237 return NULL;
237 return nullptr;
238238 }
239239 return M1;
240240 }
591591 MiscompiledFunctions,
592592 VMap);
593593 Module *Extracted = BD.ExtractMappedBlocksFromModule(Blocks, ToExtract);
594 if (Extracted == 0) {
594 if (!Extracted) {
595595 // Weird, extraction should have worked.
596596 errs() << "Nondeterministic problem extracting blocks??\n";
597597 delete ProgClone;
844844 Safe->getOrInsertFunction("getPointerToNamedFunction",
845845 Type::getInt8PtrTy(Safe->getContext()),
846846 Type::getInt8PtrTy(Safe->getContext()),
847 (Type *)0);
847 (Type *)nullptr);
848848
849849 // Use the function we just added to get addresses of functions we need.
850850 for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) {
195195 Args.push_back(InputFilename.c_str());
196196 for (unsigned i = 0; i < NumExtraArgs; ++i)
197197 Args.push_back(*ExtraArgs);
198 Args.push_back(0);
198 Args.push_back(nullptr);
199199
200200 DEBUG(errs() << "\nAbout to run:\t";
201201 for (unsigned i = 0, e = Args.size()-1; i != e; ++i)
211211
212212 // Redirect stdout and stderr to nowhere if SilencePasses is given
213213 StringRef Nowhere;
214 const StringRef *Redirects[3] = {0, &Nowhere, &Nowhere};
214 const StringRef *Redirects[3] = {nullptr, &Nowhere, &Nowhere};
215215
216216 std::string ErrMsg;
217 int result = sys::ExecuteAndWait(Prog, Args.data(), 0,
218 (SilencePasses ? Redirects : 0), Timeout,
219 MemoryLimit, &ErrMsg);
217 int result = sys::ExecuteAndWait(Prog, Args.data(), nullptr,
218 (SilencePasses ? Redirects : nullptr),
219 Timeout, MemoryLimit, &ErrMsg);
220220
221221 // If we are supposed to delete the bitcode file or if the passes crashed,
222222 // remove it now. This may fail if the file was never created, but that's ok.
263263 EmitProgressBitcode(M, "pass-error", false);
264264 exit(debugOptimizerCrash());
265265 }
266 return 0;
266 return nullptr;
267267 }
268268
269269 Module *Ret = ParseInputFile(BitcodeResult, Context);
270 if (Ret == 0) {
270 if (!Ret) {
271271 errs() << getToolName() << ": Error reading bitcode file '"
272272 << BitcodeResult << "'!\n";
273273 exit(1);
6161 StringRef StdErrFile,
6262 unsigned NumSeconds = 0,
6363 unsigned MemoryLimit = 0,
64 std::string *ErrMsg = 0) {
64 std::string *ErrMsg = nullptr) {
6565 const StringRef *Redirects[3] = { &StdInFile, &StdOutFile, &StdErrFile };
6666
6767 #if 0 // For debug purposes
7373 }
7474 #endif
7575
76 return sys::ExecuteAndWait(ProgramPath, Args, 0, Redirects,
76 return sys::ExecuteAndWait(ProgramPath, Args, nullptr, Redirects,
7777 NumSeconds, MemoryLimit, ErrMsg);
7878 }
7979
102102 #endif
103103
104104 // Run the program remotely with the remote client
105 int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, 0,
105 int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, nullptr,
106106 Redirects, NumSeconds, MemoryLimit);
107107
108108 // Has the remote client fail?
218218 // Add optional parameters to the running program from Argv
219219 for (unsigned i=0, e = Args.size(); i != e; ++i)
220220 LLIArgs.push_back(Args[i].c_str());
221 LLIArgs.push_back(0);
221 LLIArgs.push_back(nullptr);
222222
223223 outs() << ""; outs().flush();
224224 DEBUG(errs() << "\nAbout to run:\t";
276276 }
277277
278278 Message = "Cannot find `lli' in executable directory!\n";
279 return 0;
279 return nullptr;
280280 }
281281
282282 //===---------------------------------------------------------------------===//
327327 for (std::size_t i = 0; i < CompilerArgs.size(); ++i)
328328 ProgramArgs.push_back(CompilerArgs.at(i).c_str());
329329 ProgramArgs.push_back(Bitcode.c_str());
330 ProgramArgs.push_back(0);
330 ProgramArgs.push_back(nullptr);
331331
332332 // Add optional parameters to the running program from Argv
333333 for (unsigned i = 0, e = CompilerArgs.size(); i != e; ++i)
384384 for (std::size_t i = 0; i < ExecutorArgs.size(); ++i)
385385 ProgramArgs.push_back(ExecutorArgs.at(i).c_str());
386386 ProgramArgs.push_back(Bitcode.c_str());
387 ProgramArgs.push_back(0);
387 ProgramArgs.push_back(nullptr);
388388
389389 // Add optional parameters to the running program from Argv
390390 for (unsigned i = 0, e = Args.size(); i != e; ++i)
447447 std::vector Args;
448448 lexCommand(Message, CompileCommandLine, CmdPath, Args);
449449 if (CmdPath.empty())
450 return 0;
450 return nullptr;
451451
452452 return new CustomCompiler(CmdPath, Args);
453453 }
463463 std::vector Args;
464464 lexCommand(Message, ExecCommandLine, CmdPath, Args);
465465 if (CmdPath.empty())
466 return 0;
466 return nullptr;
467467
468468 return new CustomExecutor(CmdPath, Args);
469469 }
498498 if (UseIntegratedAssembler)
499499 LLCArgs.push_back("-filetype=obj");
500500
501 LLCArgs.push_back (0);
501 LLCArgs.push_back (nullptr);
502502
503503 outs() << (UseIntegratedAssembler ? "" : "");
504504 outs().flush();
558558 PrependMainExecutablePath("llc", Argv0, (void *)(intptr_t) & createLLC);
559559 if (LLCPath.empty()) {
560560 Message = "Cannot find `llc' in executable directory!\n";
561 return 0;
561 return nullptr;
562562 }
563563
564564 GCC *gcc = GCC::create(Message, GCCBinary, GCCArgs);
624624 // Add optional parameters to the running program from Argv
625625 for (unsigned i=0, e = Args.size(); i != e; ++i)
626626 JITArgs.push_back(Args[i].c_str());
627 JITArgs.push_back(0);
627 JITArgs.push_back(nullptr);
628628
629629 outs() << ""; outs().flush();
630630 DEBUG(errs() << "\nAbout to run:\t";
650650 }
651651
652652 Message = "Cannot find `lli' in executable directory!\n";
653 return 0;
653 return nullptr;
654654 }
655655
656656 //===---------------------------------------------------------------------===//
736736 #endif
737737 if (TargetTriple.getArch() == Triple::sparc)
738738 GCCArgs.push_back("-mcpu=v9");
739 GCCArgs.push_back(0); // NULL terminator
739 GCCArgs.push_back(nullptr); // NULL terminator
740740
741741 outs() << ""; outs().flush();
742742 DEBUG(errs() << "\nAbout to run:\t";
785785 // Add optional parameters to the running program from Argv
786786 for (unsigned i = 0, e = Args.size(); i != e; ++i)
787787 ProgramArgs.push_back(Args[i].c_str());
788 ProgramArgs.push_back(0); // NULL terminator
788 ProgramArgs.push_back(nullptr); // NULL terminator
789789
790790 // Now that we have a binary, run it!
791791 outs() << ""; outs().flush();
884884 // command line, so this should be safe.
885885 for (unsigned i = 0, e = ArgsForGCC.size(); i != e; ++i)
886886 GCCArgs.push_back(ArgsForGCC[i].c_str());
887 GCCArgs.push_back(0); // NULL terminator
887 GCCArgs.push_back(nullptr); // NULL terminator
888888
889889
890890
909909 std::string GCCPath = sys::FindProgramByName(GCCBinary);
910910 if (GCCPath.empty()) {
911911 Message = "Cannot find `"+ GCCBinary +"' in PATH!\n";
912 return 0;
912 return nullptr;
913913 }
914914
915915 std::string RemoteClientPath;
9898 class AddToDriver : public FunctionPassManager {
9999 BugDriver &D;
100100 public:
101 AddToDriver(BugDriver &_D) : FunctionPassManager(0), D(_D) {}
101 AddToDriver(BugDriver &_D) : FunctionPassManager(nullptr), D(_D) {}
102102
103103 void add(Pass *P) override {
104104 const void *ID = P->getPassID();
156156 if (!error.empty()) {
157157 errs() << error << '\n';
158158 delete FDOut;
159 return 0;
159 return nullptr;
160160 }
161161
162162 return FDOut;
206206 // Load the module to be compiled...
207207 SMDiagnostic Err;
208208 std::unique_ptr M;
209 Module *mod = 0;
209 Module *mod = nullptr;
210210 Triple TheTriple;
211211
212212 bool SkipModule = MCPU == "help" ||
222222 if (!SkipModule) {
223223 M.reset(ParseIRFile(InputFilename, Err, Context));
224224 mod = M.get();
225 if (mod == 0) {
225 if (mod == nullptr) {
226226 Err.print(argv[0], errs());
227227 return 1;
228228 }
320320 {
321321 formatted_raw_ostream FOS(Out->os());
322322
323 AnalysisID StartAfterID = 0;
324 AnalysisID StopAfterID = 0;
323 AnalysisID StartAfterID = nullptr;
324 AnalysisID StopAfterID = nullptr;
325325 const PassRegistry *PR = PassRegistry::getPassRegistry();
326326 if (!StartAfter.empty()) {
327327 const PassInfo *PI = PR->getPassInfo(StartAfter);
178178 void RemoteMemoryManager::AllocateGOT() { llvm_unreachable("Unexpected!"); }
179179 uint8_t *RemoteMemoryManager::getGOTBase() const {
180180 llvm_unreachable("Unexpected!");
181 return 0;
181 return nullptr;
182182 }
183183 uint8_t *RemoteMemoryManager::startFunctionBody(const Function *F, uintptr_t &ActualSize){
184184 llvm_unreachable("Unexpected!");
185 return 0;
185 return nullptr;
186186 }
187187 uint8_t *RemoteMemoryManager::allocateStub(const GlobalValue* F, unsigned StubSize,
188188 unsigned Alignment) {
189189 llvm_unreachable("Unexpected!");
190 return 0;
190 return nullptr;
191191 }
192192 void RemoteMemoryManager::endFunctionBody(const Function *F, uint8_t *FunctionStart,
193193 uint8_t *FunctionEnd) {
195195 }
196196 uint8_t *RemoteMemoryManager::allocateSpace(intptr_t Size, unsigned Alignment) {
197197 llvm_unreachable("Unexpected!");
198 return 0;
198 return nullptr;
199199 }
200200 uint8_t *RemoteMemoryManager::allocateGlobal(uintptr_t Size, unsigned Alignment) {
201201 llvm_unreachable("Unexpected!");
202 return 0;
202 return nullptr;
203203 }
204204 void RemoteMemoryManager::deallocateFunctionBody(void *Body) {
205205 llvm_unreachable("Unexpected!");
2929
3030 bool RemoteTarget::allocateSpace(size_t Size, unsigned Alignment,
3131 uint64_t &Address) {
32 sys::MemoryBlock *Prev = Allocations.size() ? &Allocations.back() : NULL;
32 sys::MemoryBlock *Prev = Allocations.size() ? &Allocations.back() : nullptr;
3333 sys::MemoryBlock Mem = sys::Memory::AllocateRWX(Size, Prev, &ErrorMsg);
34 if (Mem.base() == NULL)
34 if (Mem.base() == nullptr)
3535 return false;
3636 if ((uintptr_t)Mem.base() % Alignment) {
3737 ErrorMsg = "unable to allocate sufficiently aligned memory";
282282 const std::string ModuleID = M->getModuleIdentifier();
283283 std::string CacheName;
284284 if (!getCacheFilename(ModuleID, CacheName))
285 return NULL;
285 return nullptr;
286286 // Load the object from the cache filename
287287 std::unique_ptr IRObjectBuffer;
288288 MemoryBuffer::getFile(CacheName.c_str(), IRObjectBuffer, -1, false);
289289 // If the file isn't there, that's OK.
290290 if (!IRObjectBuffer)
291 return NULL;
291 return nullptr;
292292 // MCJIT will want to write into this buffer, and we don't want that
293293 // because the file has probably just been mmapped. Instead we make
294294 // a copy. The filed-based buffer will be released when it goes
319319 }
320320 };
321321
322 static ExecutionEngine *EE = 0;
323 static LLIObjectCache *CacheManager = 0;
322 static ExecutionEngine *EE = nullptr;
323 static LLIObjectCache *CacheManager = nullptr;
324324
325325 static void do_shutdown() {
326326 // Cygwin-1.5 invokes DLL's dtors before atexit handler.
449449 Mod->setTargetTriple(Triple::normalize(TargetTriple));
450450
451451 // Enable MCJIT if desired.
452 RTDyldMemoryManager *RTDyldMM = 0;
452 RTDyldMemoryManager *RTDyldMM = nullptr;
453453 if (UseMCJIT && !ForceInterpreter) {
454454 builder.setUseMCJIT(true);
455455 if (RemoteMCJIT)
462462 errs() << "error: Remote process execution requires -use-mcjit\n";
463463 exit(1);
464464 }
465 builder.setJITMemoryManager(ForceInterpreter ? 0 :
465 builder.setJITMemoryManager(ForceInterpreter ? nullptr :
466466 JITMemoryManager::CreateDefaultMemManager());
467467 }
468468
855855 Output.keep();
856856 Out.close();
857857 sys::fs::rename(TemporaryOutput, ArchiveName);
858 TemporaryOutput = NULL;
858 TemporaryOutput = nullptr;
859859 }
860860
861861 static void createSymbolTable(object::Archive *OldArchive) {
968968 }
969969 }
970970
971 performOperation(Operation, NULL);
971 performOperation(Operation, nullptr);
972972 return 0;
973973 }
9393 // Parse the file now...
9494 SMDiagnostic Err;
9595 std::unique_ptr M(ParseAssemblyFile(InputFilename, Err, Context));
96 if (M.get() == 0) {
96 if (!M.get()) {
9797 Err.print(argv[0], errs());
9898 return 1;
9999 }
8383 if (BlockID < bitc::FIRST_APPLICATION_BLOCKID) {
8484 if (BlockID == bitc::BLOCKINFO_BLOCK_ID)
8585 return "BLOCKINFO_BLOCK";
86 return 0;
86 return nullptr;
8787 }
8888
8989 // Check to see if we have a blockinfo record for this block, with a name.
9494 }
9595
9696
97 if (CurStreamType != LLVMIRBitstream) return 0;
97 if (CurStreamType != LLVMIRBitstream) return nullptr;
9898
9999 switch (BlockID) {
100 default: return 0;
100 default: return nullptr;
101101 case bitc::MODULE_BLOCK_ID: return "MODULE_BLOCK";
102102 case bitc::PARAMATTR_BLOCK_ID: return "PARAMATTR_BLOCK";
103103 case bitc::PARAMATTR_GROUP_BLOCK_ID: return "PARAMATTR_GROUP_BLOCK_ID";
119119 if (BlockID < bitc::FIRST_APPLICATION_BLOCKID) {
120120 if (BlockID == bitc::BLOCKINFO_BLOCK_ID) {
121121 switch (CodeID) {
122 default: return 0;
122 default: return nullptr;
123123 case bitc::BLOCKINFO_CODE_SETBID: return "SETBID";
124124 case bitc::BLOCKINFO_CODE_BLOCKNAME: return "BLOCKNAME";
125125 case bitc::BLOCKINFO_CODE_SETRECORDNAME: return "SETRECORDNAME";
126126 }
127127 }
128 return 0;
128 return nullptr;
129129 }
130130
131131 // Check to see if we have a blockinfo record for this record, with a name.
137137 }
138138
139139
140 if (CurStreamType != LLVMIRBitstream) return 0;
140 if (CurStreamType != LLVMIRBitstream) return nullptr;
141141
142142 switch (BlockID) {
143 default: return 0;
143 default: return nullptr;
144144 case bitc::MODULE_BLOCK_ID:
145145 switch (CodeID) {
146 default: return 0;
146 default: return nullptr;
147147 case bitc::MODULE_CODE_VERSION: return "VERSION";
148148 case bitc::MODULE_CODE_TRIPLE: return "TRIPLE";
149149 case bitc::MODULE_CODE_DATALAYOUT: return "DATALAYOUT";
158158 }
159159 case bitc::PARAMATTR_BLOCK_ID:
160160 switch (CodeID) {
161 default: return 0;
161 default: return nullptr;
162162 case bitc::PARAMATTR_CODE_ENTRY_OLD: return "ENTRY";
163163 case bitc::PARAMATTR_CODE_ENTRY: return "ENTRY";
164164 case bitc::PARAMATTR_GRP_CODE_ENTRY: return "ENTRY";
165165 }
166166 case bitc::TYPE_BLOCK_ID_NEW:
167167 switch (CodeID) {
168 default: return 0;
168 default: return nullptr;
169169 case bitc::TYPE_CODE_NUMENTRY: return "NUMENTRY";
170170 case bitc::TYPE_CODE_VOID: return "VOID";
171171 case bitc::TYPE_CODE_FLOAT: return "FLOAT";
188188
189189 case bitc::CONSTANTS_BLOCK_ID:
190190 switch (CodeID) {
191 default: return 0;
191 default: return nullptr;
192192 case bitc::CST_CODE_SETTYPE: return "SETTYPE";
193193 case bitc::CST_CODE_NULL: return "NULL";
194194 case bitc::CST_CODE_UNDEF: return "UNDEF";
214214 }
215215 case bitc::FUNCTION_BLOCK_ID:
216216 switch (CodeID) {
217 default: return 0;
217 default: return nullptr;
218218 case bitc::FUNC_CODE_DECLAREBLOCKS: return "DECLAREBLOCKS";
219219
220220 case bitc::FUNC_CODE_INST_BINOP: return "INST_BINOP";
248248 }
249249 case bitc::VALUE_SYMTAB_BLOCK_ID:
250250 switch (CodeID) {
251 default: return 0;
251 default: return nullptr;
252252 case bitc::VST_CODE_ENTRY: return "ENTRY";
253253 case bitc::VST_CODE_BBENTRY: return "BBENTRY";
254254 }
255255 case bitc::METADATA_ATTACHMENT_ID:
256256 switch(CodeID) {
257 default:return 0;
257 default:return nullptr;
258258 case bitc::METADATA_ATTACHMENT: return "METADATA_ATTACHMENT";
259259 }
260260 case bitc::METADATA_BLOCK_ID:
261261 switch(CodeID) {
262 default:return 0;
262 default:return nullptr;
263263 case bitc::METADATA_STRING: return "METADATA_STRING";
264264 case bitc::METADATA_NAME: return "METADATA_NAME";
265265 case bitc::METADATA_KIND: return "METADATA_KIND";
269269 }
270270 case bitc::USELIST_BLOCK_ID:
271271 switch(CodeID) {
272 default:return 0;
272 default:return nullptr;
273273 case bitc::USELIST_CODE_ENTRY: return "USELIST_CODE_ENTRY";
274274 }
275275 }
344344 if (Stream.EnterSubBlock(BlockID, &NumWords))
345345 return Error("Malformed block record");
346346
347 const char *BlockName = 0;
347 const char *BlockName = nullptr;
348348 if (Dump) {
349349 outs() << Indent << "<";
350350 if ((BlockName = GetBlockName(BlockID, *Stream.getBitStreamReader())))
3434 }
3535 void DiffLogBuilder::addLeft(Instruction *L) {
3636 // HACK: VS 2010 has a bug in the stdlib that requires this.
37 Diff.push_back(DiffRecord(L, DiffRecord::second_type(0)));
37 Diff.push_back(DiffRecord(L, DiffRecord::second_type(nullptr)));
3838 }
3939 void DiffLogBuilder::addRight(Instruction *R) {
4040 // HACK: VS 2010 has a bug in the stdlib that requires this.
41 Diff.push_back(DiffRecord(DiffRecord::first_type(0), R));
41 Diff.push_back(DiffRecord(DiffRecord::first_type(nullptr), R));
4242 }
4343
4444 unsigned DiffLogBuilder::getNumLines() const { return Diff.size(); }
134134 DisplayFilename = InputFilename;
135135 M.reset(getStreamedBitcodeModule(DisplayFilename, streamer, Context,
136136 &ErrorMessage));
137 if(M.get() != 0) {
137 if(M.get()) {
138138 if (error_code EC = M->materializeAllPermanently()) {
139139 ErrorMessage = EC.message();
140140 M.reset();
142142 }
143143 }
144144
145 if (M.get() == 0) {
145 if (!M.get()) {
146146 errs() << argv[0] << ": ";
147147 if (ErrorMessage.size())
148148 errs() << ErrorMessage << "\n";
102102 std::unique_ptr M;
103103 M.reset(getLazyIRFileModule(InputFilename, Err, Context));
104104
105 if (M.get() == 0) {
105 if (!M.get()) {
106106 Err.print(argv[0], errs());
107107 return 1;
108108 }
6060 LLVMContext& Context) {
6161 SMDiagnostic Err;
6262 if (Verbose) errs() << "Loading '" << FN << "'\n";
63 Module* Result = 0;
63 Module* Result = nullptr;
6464
6565 Result = ParseIRFile(FN, Err, Context);
6666 if (Result) return Result; // Load successful!
6767
6868 Err.print(argv0, errs());
69 return NULL;
69 return nullptr;
7070 }
7171
7272 int main(int argc, char **argv) {
8383
8484 std::unique_ptr Composite(
8585 LoadFile(argv[0], InputFilenames[BaseArg], Context));
86 if (Composite.get() == 0) {
86 if (!Composite.get()) {
8787 errs() << argv[0] << ": error loading file '"
8888 << InputFilenames[BaseArg] << "'\n";
8989 return 1;
9292 Linker L(Composite.get(), SuppressWarnings);
9393 for (unsigned i = BaseArg+1; i < InputFilenames.size(); ++i) {
9494 std::unique_ptr M(LoadFile(argv[0], InputFilenames[i], Context));
95 if (M.get() == 0) {
95 if (!M.get()) {
9696 errs() << argv[0] << ": error loading file '" <
9797 return 1;
9898 }
147147 std::string ErrorInfo;
148148 const void *Code = CodeGen.compile(&len, DisableOpt, DisableInline,
149149 DisableGVNLoadPRE, ErrorInfo);
150 if (Code == NULL) {
150 if (!Code) {
151151 errs() << argv[0]
152152 << ": error compiling the code: " << ErrorInfo << "\n";
153153 return 1;
164164 FileStream.write(reinterpret_cast(Code), len);
165165 } else {
166166 std::string ErrorInfo;
167 const char *OutputName = NULL;
167 const char *OutputName = nullptr;
168168 if (!CodeGen.compile_to_file(&OutputName, DisableOpt, DisableInline,
169169 DisableGVNLoadPRE, ErrorInfo)) {
170170 errs() << argv[0]
174174 }
175175
176176 // Set up the MCContext for creating symbols and MCExpr's.
177 MCContext Ctx(MAI.get(), MRI.get(), 0);
177 MCContext Ctx(MAI.get(), MRI.get(), nullptr);
178178
179179 std::unique_ptr DisAsm(
180180 T.createMCDisassembler(STI, Ctx));
197197 Error);
198198 if (!TheTarget) {
199199 errs() << ProgName << ": " << Error;
200 return 0;
200 return nullptr;
201201 }
202202
203203 // Update the triple name and return the found target.
215215 if (!Err.empty()) {
216216 errs() << Err << '\n';
217217 delete Out;
218 return 0;
218 return nullptr;
219219 }
220220
221221 return Out;
434434 std::unique_ptr STI(
435435 TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
436436
437 MCInstPrinter *IP = NULL;
437 MCInstPrinter *IP = nullptr;
438438 if (FileType == OFT_AssemblyFile) {
439439 IP =
440440 TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MCII, *MRI, *STI);
441 MCCodeEmitter *CE = 0;
442 MCAsmBackend *MAB = 0;
441 MCCodeEmitter *CE = nullptr;
442 MCAsmBackend *MAB = nullptr;
443443 if (ShowEncoding) {
444444 CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
445445 MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU);
6464
6565 errs() << "llvm-objdump: error: unable to get target for '" << TripleName
6666 << "', see --version and --triple.\n";
67 return 0;
67 return nullptr;
6868 }
6969
7070 struct SymbolSorter {
225225 TheTarget->createMCAsmInfo(*MRI, TripleName));
226226 std::unique_ptr STI(
227227 TheTarget->createMCSubtargetInfo(TripleName, "", ""));
228 MCContext Ctx(AsmInfo.get(), MRI.get(), 0);
228 MCContext Ctx(AsmInfo.get(), MRI.get(), nullptr);
229229 std::unique_ptr DisAsm(
230230 TheTarget->createMCDisassembler(*STI, Ctx));
231231 int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
156156 return true;
157157 }
158158
159 static const Target *getTarget(const ObjectFile *Obj = NULL) {
159 static const Target *getTarget(const ObjectFile *Obj = nullptr) {
160160 // Figure out the target triple.
161161 llvm::Triple TheTriple("unknown-unknown-unknown");
162162 if (TripleName.empty()) {
182182 Error);
183183 if (!TheTarget) {
184184 errs() << ToolName << ": " << Error;
185 return 0;
185 return nullptr;
186186 }
187187
188188 // Update the triple name and return the found target.
155155
156156 StringRef ProgName(sys::path::filename(argv[0]));
157157 if (argc > 1) {
158 int (*func)(int, const char *[]) = 0;
158 int (*func)(int, const char *[]) = nullptr;
159159
160160 if (strcmp(argv[1], "merge") == 0)
161161 func = merge_main;
125125
126126 uint64_t Value = ParseInteger(Data, Offset);
127127 StringRef ValueDesc =
128 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
128 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
129129 PrintAttribute(Tag, Value, ValueDesc);
130130 }
131131
152152
153153 uint64_t Value = ParseInteger(Data, Offset);
154154 StringRef ValueDesc =
155 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
155 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
156156 PrintAttribute(Tag, Value, ValueDesc);
157157 }
158158
162162
163163 uint64_t Value = ParseInteger(Data, Offset);
164164 StringRef ValueDesc =
165 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
165 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
166166 PrintAttribute(Tag, Value, ValueDesc);
167167 }
168168
175175
176176 uint64_t Value = ParseInteger(Data, Offset);
177177 StringRef ValueDesc =
178 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
178 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
179179 PrintAttribute(Tag, Value, ValueDesc);
180180 }
181181
185185
186186 uint64_t Value = ParseInteger(Data, Offset);
187187 StringRef ValueDesc =
188 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
188 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
189189 PrintAttribute(Tag, Value, ValueDesc);
190190 }
191191
197197
198198 uint64_t Value = ParseInteger(Data, Offset);
199199 StringRef ValueDesc =
200 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
200 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
201201 PrintAttribute(Tag, Value, ValueDesc);
202202 }
203203
210210
211211 uint64_t Value = ParseInteger(Data, Offset);
212212 StringRef ValueDesc =
213 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
213 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
214214 PrintAttribute(Tag, Value, ValueDesc);
215215 }
216216
220220
221221 uint64_t Value = ParseInteger(Data, Offset);
222222 StringRef ValueDesc =
223 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
223 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
224224 PrintAttribute(Tag, Value, ValueDesc);
225225 }
226226
232232
233233 uint64_t Value = ParseInteger(Data, Offset);
234234 StringRef ValueDesc =
235 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
235 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
236236 PrintAttribute(Tag, Value, ValueDesc);
237237 }
238238
242242
243243 uint64_t Value = ParseInteger(Data, Offset);
244244 StringRef ValueDesc =
245 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
245 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
246246 PrintAttribute(Tag, Value, ValueDesc);
247247 }
248248
252252
253253 uint64_t Value = ParseInteger(Data, Offset);
254254 StringRef ValueDesc =
255 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
255 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
256256 PrintAttribute(Tag, Value, ValueDesc);
257257 }
258258
264264
265265 uint64_t Value = ParseInteger(Data, Offset);
266266 StringRef ValueDesc =
267 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
267 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
268268 PrintAttribute(Tag, Value, ValueDesc);
269269 }
270270
274274
275275 uint64_t Value = ParseInteger(Data, Offset);
276276 StringRef ValueDesc =
277 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
277 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
278278 PrintAttribute(Tag, Value, ValueDesc);
279279 }
280280
284284
285285 uint64_t Value = ParseInteger(Data, Offset);
286286 StringRef ValueDesc =
287 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
287 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
288288 PrintAttribute(Tag, Value, ValueDesc);
289289 }
290290
294294
295295 uint64_t Value = ParseInteger(Data, Offset);
296296 StringRef ValueDesc =
297 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
297 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
298298 PrintAttribute(Tag, Value, ValueDesc);
299299 }
300300
305305
306306 uint64_t Value = ParseInteger(Data, Offset);
307307 StringRef ValueDesc =
308 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
308 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
309309 PrintAttribute(Tag, Value, ValueDesc);
310310 }
311311
317317
318318 uint64_t Value = ParseInteger(Data, Offset);
319319 StringRef ValueDesc =
320 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
320 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
321321 PrintAttribute(Tag, Value, ValueDesc);
322322 }
323323
370370
371371 uint64_t Value = ParseInteger(Data, Offset);
372372 StringRef ValueDesc =
373 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
373 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
374374 PrintAttribute(Tag, Value, ValueDesc);
375375 }
376376
382382
383383 uint64_t Value = ParseInteger(Data, Offset);
384384 StringRef ValueDesc =
385 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
385 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
386386 PrintAttribute(Tag, Value, ValueDesc);
387387 }
388388
394394
395395 uint64_t Value = ParseInteger(Data, Offset);
396396 StringRef ValueDesc =
397 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
397 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
398398 PrintAttribute(Tag, Value, ValueDesc);
399399 }
400400
404404
405405 uint64_t Value = ParseInteger(Data, Offset);
406406 StringRef ValueDesc =
407 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
407 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
408408 PrintAttribute(Tag, Value, ValueDesc);
409409 }
410410
418418
419419 uint64_t Value = ParseInteger(Data, Offset);
420420 StringRef ValueDesc =
421 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
421 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
422422 PrintAttribute(Tag, Value, ValueDesc);
423423 }
424424
432432
433433 uint64_t Value = ParseInteger(Data, Offset);
434434 StringRef ValueDesc =
435 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
435 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
436436 PrintAttribute(Tag, Value, ValueDesc);
437437 }
438438
464464
465465 uint64_t Value = ParseInteger(Data, Offset);
466466 StringRef ValueDesc =
467 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
467 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
468468 PrintAttribute(Tag, Value, ValueDesc);
469469 }
470470
474474
475475 uint64_t Value = ParseInteger(Data, Offset);
476476 StringRef ValueDesc =
477 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
477 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
478478 PrintAttribute(Tag, Value, ValueDesc);
479479 }
480480
484484
485485 uint64_t Value = ParseInteger(Data, Offset);
486486 StringRef ValueDesc =
487 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
487 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
488488 PrintAttribute(Tag, Value, ValueDesc);
489489 }
490490
494494
495495 uint64_t Value = ParseInteger(Data, Offset);
496496 StringRef ValueDesc =
497 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
497 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
498498 PrintAttribute(Tag, Value, ValueDesc);
499499 }
500500
506506
507507 uint64_t Value = ParseInteger(Data, Offset);
508508 StringRef ValueDesc =
509 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
509 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
510510 PrintAttribute(Tag, Value, ValueDesc);
511511 }
512512
516516
517517 uint64_t Value = ParseInteger(Data, Offset);
518518 StringRef ValueDesc =
519 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
519 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
520520 PrintAttribute(Tag, Value, ValueDesc);
521521 }
522522
529529
530530 uint64_t Value = ParseInteger(Data, Offset);
531531 StringRef ValueDesc =
532 (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
532 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
533533 PrintAttribute(Tag, Value, ValueDesc);
534534 }
535535
533533
534534 void COFFDumper::printFileHeaders() {
535535 // Print COFF header
536 const coff_file_header *COFFHeader = 0;
536 const coff_file_header *COFFHeader = nullptr;
537537 if (error(Obj->getCOFFHeader(COFFHeader)))
538538 return;
539539
556556
557557 // Print PE header. This header does not exist if this is an object file and
558558 // not an executable.
559 const pe32_header *PEHeader = 0;
559 const pe32_header *PEHeader = nullptr;
560560 if (error(Obj->getPE32Header(PEHeader)))
561561 return;
562562 if (PEHeader)
563563 printPEHeader(PEHeader);
564564
565 const pe32plus_header *PEPlusHeader = 0;
565 const pe32plus_header *PEPlusHeader = nullptr;
566566 if (error(Obj->getPE32PlusHeader(PEPlusHeader)))
567567 return;
568568 if (PEPlusHeader)
692692 break;
693693 }
694694 case COFF::DEBUG_STRING_TABLE_SUBSECTION:
695 if (PayloadSize == 0 || StringTable.data() != 0 ||
695 if (PayloadSize == 0 || StringTable.data() != nullptr ||
696696 Contents.back() != '\0') {
697697 // Empty or duplicate or non-null-terminated subsection.
698698 error(object_error::parse_failed);
704704 // Holds the translation table from file indices
705705 // to offsets in the string table.
706706
707 if (PayloadSize == 0 || FileIndexToStringOffsetTable.data() != 0) {
707 if (PayloadSize == 0 ||
708 FileIndexToStringOffsetTable.data() != nullptr) {
708709 // Empty or duplicate subsection.
709710 error(object_error::parse_failed);
710711 return;
10891090 W.printString("UnwindInfoAddress",
10901091 formatSymbol(Rels, OffsetInSection + 8, RTF.UnwindInfoOffset));
10911092
1092 const coff_section* XData = 0;
1093 const coff_section* XData = nullptr;
10931094 uint64_t UnwindInfoOffset = 0;
10941095 if (error(getSection(Rels, OffsetInSection + 8, &XData, &UnwindInfoOffset)))
10951096 return;
651651 std::string FullSymbolName(SymbolName);
652652 if (Symbol.isDynamic()) {
653653 bool IsDefault;
654 ErrorOr Version = Obj->getSymbolVersion(0, &*Symbol, IsDefault);
654 ErrorOr Version = Obj->getSymbolVersion(nullptr, &*Symbol,
655 IsDefault);
655656 if (Version) {
656657 FullSymbolName += (IsDefault ? "@@" : "@");
657658 FullSymbolName += *Version;
6868
6969 void *getPointerToNamedFunction(const std::string &Name,
7070 bool AbortOnFailure = true) override {
71 return 0;
71 return nullptr;
7272 }
7373
7474 bool finalizeMemory(std::string *ErrMsg) override { return false; }
8484 unsigned Alignment,
8585 unsigned SectionID,
8686 StringRef SectionName) {
87 sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);
87 sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, nullptr, nullptr);
8888 FunctionMemory.push_back(MB);
8989 return (uint8_t*)MB.base();
9090 }
9494 unsigned SectionID,
9595 StringRef SectionName,
9696 bool IsReadOnly) {
97 sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);
97 sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, nullptr, nullptr);
9898 DataMemory.push_back(MB);
9999 return (uint8_t*)MB.base();
100100 }
212212
213213 // Get the address of the entry point (_main by default).
214214 void *MainAddress = Dyld.getSymbolAddress(EntryPoint);
215 if (MainAddress == 0)
215 if (!MainAddress)
216216 return Error("no definition for '" + EntryPoint + "'");
217217
218218 // Invalidate the instruction cache for each loaded function.
233233 const char **Argv = new const char*[2];
234234 // Use the name of the first input object module as argv[0] for the target.
235235 Argv[0] = InputFileList[0].c_str();
236 Argv[1] = 0;
236 Argv[1] = nullptr;
237237 return Main(1, Argv);
238238 }
239239
9292 std::string fmtbuf;
9393 raw_string_ostream fmt(fmtbuf);
9494
95 const char *radix_fmt = 0;
95 const char *radix_fmt = nullptr;
9696 switch (Radix) {
9797 case octal:
9898 radix_fmt = PRIo64;
244244
245245 /// Pick a random scalar type.
246246 Type *pickScalarType() {
247 Type *t = 0;
247 Type *t = nullptr;
248248 do {
249249 switch (Ran->Rand() % 30) {
250250 case 0: t = Type::getInt1Ty(Context); break;
270270 case 29: if (GenX86MMX) t = Type::getX86_MMXTy(Context); break;
271271 default: llvm_unreachable("Invalid scalar value");
272272 }
273 } while (t == 0);
273 } while (t == nullptr);
274274
275275 return t;
276276 }
170170 std::string LLVMSymbolizer::symbolizeCode(const std::string &ModuleName,
171171 uint64_t ModuleOffset) {
172172 ModuleInfo *Info = getOrCreateModuleInfo(ModuleName);
173 if (Info == 0)
173 if (!Info)
174174 return printDILineInfo(DILineInfo());
175175 if (Opts.PrintInlining) {
176176 DIInliningInfo InlinedContext =
231231 std::string &Result) {
232232 std::string OrigRealPath = OrigPath;
233233 #if defined(HAVE_REALPATH)
234 if (char *RP = realpath(OrigPath.c_str(), NULL)) {
234 if (char *RP = realpath(OrigPath.c_str(), nullptr)) {
235235 OrigRealPath = RP;
236236 free(RP);
237237 }
297297 BinaryMapTy::iterator I = BinaryForPath.find(Path);
298298 if (I != BinaryForPath.end())
299299 return I->second;
300 Binary *Bin = 0;
301 Binary *DbgBin = 0;
300 Binary *Bin = nullptr;
301 Binary *DbgBin = nullptr;
302302 ErrorOr BinaryOrErr = createBinary(Path);
303303 if (!error(BinaryOrErr.getError())) {
304304 std::unique_ptr ParsedBinary(BinaryOrErr.get());
318318 }
319319 }
320320 // Try to locate the debug binary using .gnu_debuglink section.
321 if (DbgBin == 0) {
321 if (!DbgBin) {
322322 std::string DebuglinkName;
323323 uint32_t CRCHash;
324324 std::string DebugBinaryPath;
332332 }
333333 }
334334 }
335 if (DbgBin == 0)
335 if (!DbgBin)
336336 DbgBin = Bin;
337337 BinaryPair Res = std::make_pair(Bin, DbgBin);
338338 BinaryForPath[Path] = Res;
341341
342342 ObjectFile *
343343 LLVMSymbolizer::getObjectFileFromBinary(Binary *Bin, const std::string &ArchName) {
344 if (Bin == 0)
345 return 0;
346 ObjectFile *Res = 0;
344 if (!Bin)
345 return nullptr;
346 ObjectFile *Res = nullptr;
347347 if (MachOUniversalBinary *UB = dyn_cast(Bin)) {
348348 ObjectFileForArchMapTy::iterator I = ObjectFileForArch.find(
349349 std::make_pair(UB, ArchName));
381381 ObjectFile *Obj = getObjectFileFromBinary(Binaries.first, ArchName);
382382 ObjectFile *DbgObj = getObjectFileFromBinary(Binaries.second, ArchName);
383383
384 if (Obj == 0) {
384 if (!Obj) {
385385 // Failed to find valid object file.
386 Modules.insert(make_pair(ModuleName, (ModuleInfo *)0));
387 return 0;
386 Modules.insert(make_pair(ModuleName, (ModuleInfo *)nullptr));
387 return nullptr;
388388 }
389389 DIContext *Context = DIContext::getDWARFContext(DbgObj);
390390 assert(Context);
426426 if (Name.substr(0, 2) != "_Z")
427427 return Name;
428428 int status = 0;
429 char *DemangledName = __cxa_demangle(Name.c_str(), 0, 0, &status);
429 char *DemangledName = __cxa_demangle(Name.c_str(), nullptr, nullptr, &status);
430430 if (status != 0)
431431 return Name;
432432 std::string Result = DemangledName;
8484 char quote = *pos;
8585 pos++;
8686 char *end = strchr(pos, quote);
87 if (end == 0)
87 if (!end)
8888 return false;
8989 ModuleName = std::string(pos, end - pos);
9090 pos = end + 1;
3838 CFGSCC() : FunctionPass(ID) {}
3939 bool runOnFunction(Function& func) override;
4040
41 void print(raw_ostream &O, const Module* = 0) const override { }
41 void print(raw_ostream &O, const Module* = nullptr) const override { }
4242
4343 void getAnalysisUsage(AnalysisUsage &AU) const override {
4444 AU.setPreservesAll();
5252 // run - Print out SCCs in the call graph for the specified module.
5353 bool runOnModule(Module &M) override;
5454
55 void print(raw_ostream &O, const Module* = 0) const override { }
55 void print(raw_ostream &O, const Module* = nullptr) const override { }
5656
5757 // getAnalysisUsage - This pass requires the CallGraph.
5858 void getAnalysisUsage(AnalysisUsage &AU) const override {
294294 Error);
295295 // Some modules don't specify a triple, and this is okay.
296296 if (!TheTarget) {
297 return 0;
297 return nullptr;
298298 }
299299
300300 // Package up features to be passed to target/subtarget
372372 std::unique_ptr M;
373373 M.reset(ParseIRFile(InputFilename, Err, Context));
374374
375 if (M.get() == 0) {
375 if (!M.get()) {
376376 Err.print(argv[0], errs());
377377 return 1;
378378 }
452452 Passes.add(new DataLayoutPass(M.get()));
453453
454454 Triple ModuleTriple(M->getTargetTriple());
455 TargetMachine *Machine = 0;
455 TargetMachine *Machine = nullptr;
456456 if (ModuleTriple.getArch())
457457 Machine = GetTargetMachine(Triple(ModuleTriple));
458458 std::unique_ptr TM(Machine);
536536 }
537537
538538 const PassInfo *PassInf = PassList[i];
539 Pass *P = 0;
539 Pass *P = nullptr;
540540 if (PassInf->getTargetMachineCtor())
541541 P = PassInf->getTargetMachineCtor()(TM.get());
542542 else if (PassInf->getNormalCtor())