Skip to content

Commit a72c167

Browse files
committed
[Runtime][Win32] Further tweaks to SymbolInfo.cpp and Errors.cpp.
Fix an unused variable warning in `Errors.cpp`. Use brace initialization syntax in `SymbolInfo.cpp` rather than using a constructor call. rdar://130992923
1 parent 418a240 commit a72c167

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

stdlib/public/runtime/Errors.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static bool getSymbolNameAddr(llvm::StringRef libraryName,
106106

107107
// UnDecorateSymbolName() will not fail for Swift symbols, so detect them
108108
// up-front and let Swift handle them.
109-
if (!Demangle::isMangledName(syminfo.getSymbolName())) {
109+
if (!Demangle::isMangledName(szSymbolName)) {
110110
char szUndName[1024];
111111
DWORD dwResult;
112112
dwResult = _swift_win32_withDbgHelpLibrary([&] (HANDLE hProcess) -> DWORD {
@@ -119,7 +119,7 @@ static bool getSymbolNameAddr(llvm::StringRef libraryName,
119119
dwFlags |= UNDNAME_32_BIT_DECODE;
120120
#endif
121121

122-
return UnDecorateSymbolName(syminfo.getSymbolName(), szUndName,
122+
return UnDecorateSymbolName(szSymbolName, szUndName,
123123
sizeof(szUndName), dwFlags);
124124
});
125125

stdlib/public/runtime/SymbolInfo.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ const void *SymbolInfo::getSymbolAddress() const {
7272
struct Win32ModuleInfo {
7373
const char *name;
7474
const void *base;
75-
76-
Win32ModuleInfo(const char *n, const void *b) : name(n), base(b) {}
7775
};
7876

7977
// Get the filename and base of the module that contains the specified
@@ -117,17 +115,17 @@ static Win32ModuleInfo moduleInfoFromAddress(const void *address) {
117115
if (pwszFileName != wszBuffer)
118116
::free(pwszFileName);
119117

120-
return Win32ModuleInfo(::strdup("<unknown>"), mi.lpBaseOfDll);
118+
return { ::strdup("<unknown>"), mi.lpBaseOfDll };
121119
}
122120

123121
const char *result = _swift_win32_copyUTF8FromWide(pwszFileName);
124122

125123
if (pwszFileName != wszBuffer)
126124
::free((void *)pwszFileName);
127125

128-
return Win32ModuleInfo(result, mi.lpBaseOfDll);
126+
return { result, mi.lpBaseOfDll };
129127
} else {
130-
return Win32ModuleInfo(::strdup("<unknown>"), nullptr);
128+
return { ::strdup("<unknown>"), nullptr };
131129
}
132130
}
133131
#endif

0 commit comments

Comments
 (0)