[PATCH] D120212: [Bitcode] Forward declare classes & remove includes
Clemens Wasser via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 20 07:31:32 PST 2022
clemenswasser created this revision.
Herald added a subscriber: hiraditya.
clemenswasser requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
`llvm/Support/Error.h` was identified as quiet heavy by clang build analyzer.
Removing includes and forward declaring the relevant classes saves compilation time.
https://reviews.llvm.org/D120212
Files:
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.h
Index: llvm/lib/Bitcode/Reader/MetadataLoader.h
===================================================================
--- llvm/lib/Bitcode/Reader/MetadataLoader.h
+++ llvm/lib/Bitcode/Reader/MetadataLoader.h
@@ -13,8 +13,6 @@
#ifndef LLVM_LIB_BITCODE_READER_METADATALOADER_H
#define LLVM_LIB_BITCODE_READER_METADATALOADER_H
-#include "llvm/Support/Error.h"
-
#include <functional>
#include <memory>
@@ -27,6 +25,7 @@
class Metadata;
class Module;
class Type;
+class Error;
template <typename T> class ArrayRef;
/// Helper class that handles loading Metadatas and keeping them available.
@@ -44,10 +43,10 @@
MetadataLoader(MetadataLoader &&);
// Parse a module metadata block
- Error parseModuleMetadata() { return parseMetadata(true); }
+ Error parseModuleMetadata();
// Parse a function metadata block
- Error parseFunctionMetadata() { return parseMetadata(false); }
+ Error parseFunctionMetadata();
/// Set the mode to strip TBAA metadata on load.
void setStripTBAA(bool StripTBAA = true);
Index: llvm/lib/Bitcode/Reader/MetadataLoader.cpp
===================================================================
--- llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -2326,6 +2326,10 @@
: Pimpl(std::make_unique<MetadataLoaderImpl>(
Stream, TheModule, ValueList, std::move(getTypeByID), IsImporting)) {}
+Error MetadataLoader::parseModuleMetadata() { return parseMetadata(true); }
+
+Error MetadataLoader::parseFunctionMetadata() { return parseMetadata(false); }
+
Error MetadataLoader::parseMetadata(bool ModuleLevel) {
return Pimpl->parseMetadata(ModuleLevel);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120212.410156.patch
Type: text/x-patch
Size: 1666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220220/e82f1c86/attachment.bin>
More information about the llvm-commits
mailing list