[llvm] r345367 - [llvm-nm] Simplify. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 25 23:56:52 PDT 2018
Author: maskray
Date: Thu Oct 25 23:56:51 2018
New Revision: 345367
URL: http://llvm.org/viewvc/llvm-project?rev=345367&view=rev
Log:
[llvm-nm] Simplify. NFC
Change a \t to spaces
Change some zero-filling memcpy to aggregate initialization
Delete redundant ArchiveName.clear() after declaration
Modified:
llvm/trunk/tools/llvm-nm/llvm-nm.cpp
Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=345367&r1=345366&r2=345367&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Thu Oct 25 23:56:51 2018
@@ -1181,8 +1181,7 @@ dumpSymbolNamesFromObject(SymbolicFile &
// see if this symbol is a symbol from that section and if not skip it.
if (Nsect && Nsect != getNsectInMachO(*MachO, Sym))
continue;
- NMSymbol S;
- memset(&S, '\0', sizeof(S));
+ NMSymbol S = {};
S.Size = 0;
S.Address = 0;
if (PrintSize) {
@@ -1276,8 +1275,7 @@ dumpSymbolNamesFromObject(SymbolicFile &
}
}
if (!found) {
- NMSymbol S;
- memset(&S, '\0', sizeof(NMSymbol));
+ NMSymbol S = {};
S.Address = Entry.address() + BaseSegmentAddress;
S.Size = 0;
S.TypeChar = '\0';
@@ -1367,8 +1365,7 @@ dumpSymbolNamesFromObject(SymbolicFile &
// Now create the undefined symbol using the referened dynamic
// library.
- NMSymbol U;
- memset(&U, '\0', sizeof(NMSymbol));
+ NMSymbol U = {};
U.Address = 0;
U.Size = 0;
U.TypeChar = 'U';
@@ -1434,8 +1431,7 @@ dumpSymbolNamesFromObject(SymbolicFile &
}
if (!found) {
LastSymbolName = Entry.symbolName();
- NMSymbol B;
- memset(&B, '\0', sizeof(NMSymbol));
+ NMSymbol B = {};
B.Address = 0;
B.Size = 0;
B.TypeChar = 'U';
@@ -1494,8 +1490,7 @@ dumpSymbolNamesFromObject(SymbolicFile &
}
if (!found) {
LastSymbolName = Entry.symbolName();
- NMSymbol L;
- memset(&L, '\0', sizeof(NMSymbol));
+ NMSymbol L = {};
L.Name = Entry.symbolName();
L.Address = 0;
L.Size = 0;
@@ -1633,9 +1628,8 @@ dumpSymbolNamesFromObject(SymbolicFile &
}
// See this address is not already in the symbol table fake up an
// nlist for it.
- if (!found) {
- NMSymbol F;
- memset(&F, '\0', sizeof(NMSymbol));
+ if (!found) {
+ NMSymbol F = {};
F.Name = "<redacted function X>";
F.Address = FoundFns[f] + BaseSegmentAddress;
F.Size = 0;
@@ -1902,7 +1896,6 @@ static void dumpSymbolNamesFromFile(std:
if (HostArchName == I->getArchFlagName()) {
Expected<std::unique_ptr<ObjectFile>> ObjOrErr = I->getAsObjectFile();
std::string ArchiveName;
- ArchiveName.clear();
if (ObjOrErr) {
ObjectFile &Obj = *ObjOrErr.get();
dumpSymbolNamesFromObject(Obj, false);
More information about the llvm-commits
mailing list