Skip to content

Commit 3cba717

Browse files
committed
[NFC][LLVM] Namespace cleanup in MetadataLoader.cpp
- Restrict scope of anonymous namespaces to just class declarations. - Move local static function out of anonymous namespace. - Remove a redundant assert when indexing a vector
1 parent b04f6f8 commit 3cba717

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

llvm/lib/Bitcode/Reader/MetadataLoader.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@
5858
#include <tuple>
5959
#include <utility>
6060
#include <vector>
61-
namespace llvm {
62-
class Argument;
63-
}
6461

6562
using namespace llvm;
6663

@@ -83,8 +80,6 @@ static cl::opt<bool> DisableLazyLoading(
8380

8481
namespace {
8582

86-
static int64_t unrotateSign(uint64_t U) { return (U & 1) ? ~(U >> 1) : U >> 1; }
87-
8883
class BitcodeReaderMetadataList {
8984
/// Array of metadata references.
9085
///
@@ -129,10 +124,7 @@ class BitcodeReaderMetadataList {
129124
void pop_back() { MetadataPtrs.pop_back(); }
130125
bool empty() const { return MetadataPtrs.empty(); }
131126

132-
Metadata *operator[](unsigned i) const {
133-
assert(i < MetadataPtrs.size());
134-
return MetadataPtrs[i];
135-
}
127+
Metadata *operator[](unsigned i) const { return MetadataPtrs[i]; }
136128

137129
Metadata *lookup(unsigned I) const {
138130
if (I < MetadataPtrs.size())
@@ -178,6 +170,9 @@ class BitcodeReaderMetadataList {
178170
private:
179171
Metadata *resolveTypeRefArray(Metadata *MaybeTuple);
180172
};
173+
} // namespace
174+
175+
static int64_t unrotateSign(uint64_t U) { return (U & 1) ? ~(U >> 1) : U >> 1; }
181176

182177
void BitcodeReaderMetadataList::assignValue(Metadata *MD, unsigned Idx) {
183178
if (auto *MDN = dyn_cast<MDNode>(MD))
@@ -392,8 +387,6 @@ void PlaceholderQueue::flush(BitcodeReaderMetadataList &MetadataList) {
392387
}
393388
}
394389

395-
} // anonymous namespace
396-
397390
static Error error(const Twine &Message) {
398391
return make_error<StringError>(
399392
Message, make_error_code(BitcodeError::CorruptedBitcode));

0 commit comments

Comments
 (0)