aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
diff options
context:
space:
mode:
authorRahul Joshi <rjoshi@nvidia.com>2025-09-15 10:32:45 -0700
committerGitHub <noreply@github.com>2025-09-15 10:32:45 -0700
commit3a695e1abebac0c8e9816e1649ef8032c5ffdc4b (patch)
tree880a40a08f82810300399074968d40de173e19c7 /llvm/lib/Bitcode/Reader/MetadataLoader.cpp
parent6626e6acfee0d22423e258bdcfc8e54045b0d88d (diff)
downloadllvm-3a695e1abebac0c8e9816e1649ef8032c5ffdc4b.zip
llvm-3a695e1abebac0c8e9816e1649ef8032c5ffdc4b.tar.gz
llvm-3a695e1abebac0c8e9816e1649ef8032c5ffdc4b.tar.bz2
[NFC][LLVM] Namespace cleanup in MetadataLoader.cpp (#157595)
- Remove forward declaration of `llvm::Argument` and include Argument.h instead. - 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.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/MetadataLoader.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index a5cedad..22c7fa5 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -25,6 +25,7 @@
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Bitcode/LLVMBitCodes.h"
#include "llvm/Bitstream/BitstreamReader.h"
+#include "llvm/IR/Argument.h"
#include "llvm/IR/AutoUpgrade.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
@@ -58,9 +59,6 @@
#include <tuple>
#include <utility>
#include <vector>
-namespace llvm {
-class Argument;
-}
using namespace llvm;
@@ -83,8 +81,6 @@ static cl::opt<bool> DisableLazyLoading(
namespace {
-static int64_t unrotateSign(uint64_t U) { return (U & 1) ? ~(U >> 1) : U >> 1; }
-
class BitcodeReaderMetadataList {
/// Array of metadata references.
///
@@ -129,10 +125,7 @@ public:
void pop_back() { MetadataPtrs.pop_back(); }
bool empty() const { return MetadataPtrs.empty(); }
- Metadata *operator[](unsigned i) const {
- assert(i < MetadataPtrs.size());
- return MetadataPtrs[i];
- }
+ Metadata *operator[](unsigned i) const { return MetadataPtrs[i]; }
Metadata *lookup(unsigned I) const {
if (I < MetadataPtrs.size())
@@ -178,6 +171,9 @@ public:
private:
Metadata *resolveTypeRefArray(Metadata *MaybeTuple);
};
+} // namespace
+
+static int64_t unrotateSign(uint64_t U) { return (U & 1) ? ~(U >> 1) : U >> 1; }
void BitcodeReaderMetadataList::assignValue(Metadata *MD, unsigned Idx) {
if (auto *MDN = dyn_cast<MDNode>(MD))
@@ -392,8 +388,6 @@ void PlaceholderQueue::flush(BitcodeReaderMetadataList &MetadataList) {
}
}
-} // anonymous namespace
-
static Error error(const Twine &Message) {
return make_error<StringError>(
Message, make_error_code(BitcodeError::CorruptedBitcode));