summaryrefslogtreecommitdiff
path: root/tools/llvm-symbolizer
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2014-04-25 04:24:47 +0000
committerCraig Topper <craig.topper@gmail.com>2014-04-25 04:24:47 +0000
commit573faecacf5277b338f27c541c93c364ff284304 (patch)
treee240fe811c81316de881fab14446e6faeab052e4 /tools/llvm-symbolizer
parentac16f0e024c5517c01692b6f7bb5a85616575f4f (diff)
downloadllvm-573faecacf5277b338f27c541c93c364ff284304.tar.gz
llvm-573faecacf5277b338f27c541c93c364ff284304.tar.bz2
llvm-573faecacf5277b338f27c541c93c364ff284304.tar.xz
[C++] Use 'nullptr'. Tools edition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-symbolizer')
-rw-r--r--tools/llvm-symbolizer/LLVMSymbolize.cpp26
-rw-r--r--tools/llvm-symbolizer/llvm-symbolizer.cpp2
2 files changed, 14 insertions, 14 deletions
diff --git a/tools/llvm-symbolizer/LLVMSymbolize.cpp b/tools/llvm-symbolizer/LLVMSymbolize.cpp
index 837ed19aa4..4a9bbe5e82 100644
--- a/tools/llvm-symbolizer/LLVMSymbolize.cpp
+++ b/tools/llvm-symbolizer/LLVMSymbolize.cpp
@@ -171,7 +171,7 @@ const char LLVMSymbolizer::kBadString[] = "??";
std::string LLVMSymbolizer::symbolizeCode(const std::string &ModuleName,
uint64_t ModuleOffset) {
ModuleInfo *Info = getOrCreateModuleInfo(ModuleName);
- if (Info == 0)
+ if (!Info)
return printDILineInfo(DILineInfo());
if (Opts.PrintInlining) {
DIInliningInfo InlinedContext =
@@ -232,7 +232,7 @@ static bool findDebugBinary(const std::string &OrigPath,
std::string &Result) {
std::string OrigRealPath = OrigPath;
#if defined(HAVE_REALPATH)
- if (char *RP = realpath(OrigPath.c_str(), NULL)) {
+ if (char *RP = realpath(OrigPath.c_str(), nullptr)) {
OrigRealPath = RP;
free(RP);
}
@@ -298,8 +298,8 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
BinaryMapTy::iterator I = BinaryForPath.find(Path);
if (I != BinaryForPath.end())
return I->second;
- Binary *Bin = 0;
- Binary *DbgBin = 0;
+ Binary *Bin = nullptr;
+ Binary *DbgBin = nullptr;
ErrorOr<Binary *> BinaryOrErr = createBinary(Path);
if (!error(BinaryOrErr.getError())) {
std::unique_ptr<Binary> ParsedBinary(BinaryOrErr.get());
@@ -319,7 +319,7 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
}
}
// Try to locate the debug binary using .gnu_debuglink section.
- if (DbgBin == 0) {
+ if (!DbgBin) {
std::string DebuglinkName;
uint32_t CRCHash;
std::string DebugBinaryPath;
@@ -333,7 +333,7 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
}
}
}
- if (DbgBin == 0)
+ if (!DbgBin)
DbgBin = Bin;
BinaryPair Res = std::make_pair(Bin, DbgBin);
BinaryForPath[Path] = Res;
@@ -342,9 +342,9 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
ObjectFile *
LLVMSymbolizer::getObjectFileFromBinary(Binary *Bin, const std::string &ArchName) {
- if (Bin == 0)
- return 0;
- ObjectFile *Res = 0;
+ if (!Bin)
+ return nullptr;
+ ObjectFile *Res = nullptr;
if (MachOUniversalBinary *UB = dyn_cast<MachOUniversalBinary>(Bin)) {
ObjectFileForArchMapTy::iterator I = ObjectFileForArch.find(
std::make_pair(UB, ArchName));
@@ -382,10 +382,10 @@ LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) {
ObjectFile *Obj = getObjectFileFromBinary(Binaries.first, ArchName);
ObjectFile *DbgObj = getObjectFileFromBinary(Binaries.second, ArchName);
- if (Obj == 0) {
+ if (!Obj) {
// Failed to find valid object file.
- Modules.insert(make_pair(ModuleName, (ModuleInfo *)0));
- return 0;
+ Modules.insert(make_pair(ModuleName, (ModuleInfo *)nullptr));
+ return nullptr;
}
DIContext *Context = DIContext::getDWARFContext(DbgObj);
assert(Context);
@@ -427,7 +427,7 @@ std::string LLVMSymbolizer::DemangleName(const std::string &Name) {
if (Name.substr(0, 2) != "_Z")
return Name;
int status = 0;
- char *DemangledName = __cxa_demangle(Name.c_str(), 0, 0, &status);
+ char *DemangledName = __cxa_demangle(Name.c_str(), nullptr, nullptr, &status);
if (status != 0)
return Name;
std::string Result = DemangledName;
diff --git a/tools/llvm-symbolizer/llvm-symbolizer.cpp b/tools/llvm-symbolizer/llvm-symbolizer.cpp
index 83f5c5ea88..1680470f85 100644
--- a/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ b/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -85,7 +85,7 @@ static bool parseCommand(bool &IsData, std::string &ModuleName,
char quote = *pos;
pos++;
char *end = strchr(pos, quote);
- if (end == 0)
+ if (!end)
return false;
ModuleName = std::string(pos, end - pos);
pos = end + 1;