blob: ce33923c136eb174058dcf53a47e8626175b5769 [file] [log] [blame]
Nick Kledzik80fe9072013-01-08 23:43:11 +00001//===- Core/File.cpp - A Container of Atoms -------------------------------===//
Michael J. Spencer773a8fb2011-12-18 08:27:59 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Michael J. Spencer773a8fb2011-12-18 08:27:59 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "lld/Core/File.h"
Rui Ueyamad4730ea2015-01-16 15:54:13 +000010#include <mutex>
Michael J. Spencer773a8fb2011-12-18 08:27:59 +000011
12namespace lld {
13
Eugene Zelenko22886a22016-11-05 01:00:56 +000014File::~File() = default;
Rui Ueyama553ac402014-09-08 18:01:42 +000015
Rui Ueyamade40bd42015-04-08 23:05:59 +000016File::AtomVector<DefinedAtom> File::_noDefinedAtoms;
17File::AtomVector<UndefinedAtom> File::_noUndefinedAtoms;
18File::AtomVector<SharedLibraryAtom> File::_noSharedLibraryAtoms;
19File::AtomVector<AbsoluteAtom> File::_noAbsoluteAtoms;
Nick Kledzik6b079f52013-01-05 02:22:35 +000020
Rui Ueyamad4730ea2015-01-16 15:54:13 +000021std::error_code File::parse() {
22 std::lock_guard<std::mutex> lock(_parseMutex);
23 if (!_lastError.hasValue())
24 _lastError = doParse();
25 return _lastError.getValue();
26}
27
Eugene Zelenko22886a22016-11-05 01:00:56 +000028} // end namespace lld