Skip to content

Commit 67456ef

Browse files
committed
Initialize Process to &Invalid instead of nullptr, so an additional bool is not needed
1 parent 929527a commit 67456ef

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/lib/Support/DynamicLibrary.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ using namespace llvm::sys;
2525
class DynamicLibrary::HandleSet {
2626
typedef std::vector<void *> HandleList;
2727
HandleList Handles;
28-
void *Process = nullptr;
29-
bool ProcessAdded = false;
28+
void *Process = &Invalid;
3029

3130
public:
3231
static void *DLOpen(const char *Filename, std::string *Err);
@@ -59,15 +58,14 @@ class DynamicLibrary::HandleSet {
5958
Handles.push_back(Handle);
6059
} else {
6160
#ifndef _WIN32
62-
if (Process) {
61+
if (Process != &Invalid) {
6362
if (CanClose)
6463
DLClose(Process);
6564
if (Process == Handle)
6665
return false;
6766
}
6867
#endif
6968
Process = Handle;
70-
ProcessAdded = true;
7169
}
7270
return true;
7371
}
@@ -99,11 +97,11 @@ class DynamicLibrary::HandleSet {
9997
assert(!((Order & SO_LoadedFirst) && (Order & SO_LoadedLast)) &&
10098
"Invalid Ordering");
10199

102-
if (!ProcessAdded || (Order & SO_LoadedFirst)) {
100+
if (Process == &Invalid || (Order & SO_LoadedFirst)) {
103101
if (void *Ptr = LibLookup(Symbol, Order))
104102
return Ptr;
105103
}
106-
if (ProcessAdded) {
104+
if (Process != &Invalid) {
107105
// Use OS facilities to search the current binary and all loaded libs.
108106
if (void *Ptr = DLSym(Process, Symbol))
109107
return Ptr;

0 commit comments

Comments
 (0)