Use anonymous namespace for local classes.  Patch by Rui Ueyama

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@181473 91177308-0d34-0410-b5e6-96231b3b80d8
[lld] Add "explicit" to constructors where appropriate.

Summary:
Add the explicit keyword to one-parameter
constructors to prevent unintended type conversions.

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D765

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@181483 91177308-0d34-0410-b5e6-96231b3b80d8
[lld][Core] Fix latch synchronization bug.

We need to acquire a lock before signal a condition.
Otherwise threads waiting on a condition variable can
miss a signal.

Consider two threads: Thread A executing dec() and thread
B executing sync(). The initial value of _count is 1. If
these two threads are interleaved in the following order,
thread B misses the signal sent by thread A, because at the
time thread A sends a signal, B is not waiting for it.

  Thread A                 |   Thread B
                           |   std::unique_lock<std::mutex> lock(_condMut);
                           |   while (!(_count == 0)) {
  if (--_count == 0)       |
    _cond_notify_all()     |
                           |     _cond.wait();
                           |   }

Note that "wait(lock, pred)" is equivalent to "while(!pred())
wait(lock)", so I expanded it in the above example.

Reviewers: Bigcheese

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D764

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@181484 91177308-0d34-0410-b5e6-96231b3b80d8
[lld] Add comments to InputFiles::searchLibraries() arguments.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@181492 91177308-0d34-0410-b5e6-96231b3b80d8
[lld] Use range based for loop instead of explicit iterators (no functionality change)

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@181503 91177308-0d34-0410-b5e6-96231b3b80d8