From 711c0bdbd656146f1727cbc39c8278adcf6a5a98 Mon Sep 17 00:00:00 2001 From: Francis Visoiu Mistrih Date: Wed, 3 Jul 2019 22:40:07 +0000 Subject: [PATCH] [Bitcode] Move Bitstream to a separate library This moves Bitcode/Bitstream*, Bitcode/BitCodes.h to Bitstream/. This is needed to avoid a circular dependency when using the bitstream code for parsing optimization remarks. Since Bitcode uses Core for the IR part: libLLVMRemarks -> Bitcode -> Core and Core uses libLLVMRemarks to generate remarks (see IR/RemarkStreamer.cpp): Core -> libLLVMRemarks we need to separate the Bitstream and Bitcode part. For clang-doc, it seems that it doesn't need the whole bitcode layer, so I updated the CMake to only use the bitstream part. Differential Revision: https://reviews.llvm.org/D63899 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365091 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Frontend/SerializedDiagnosticPrinter.h | 2 +- include/clang/Frontend/SerializedDiagnosticReader.h | 2 +- include/clang/Frontend/SerializedDiagnostics.h | 2 +- include/clang/Serialization/ASTBitCodes.h | 2 +- include/clang/Serialization/ASTReader.h | 2 +- include/clang/Serialization/ASTWriter.h | 2 +- include/clang/Serialization/Module.h | 2 +- lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 2 +- lib/Frontend/ASTUnit.cpp | 2 +- lib/Frontend/CMakeLists.txt | 1 + lib/Frontend/SerializedDiagnosticReader.cpp | 4 ++-- lib/Frontend/TestModuleFileExtension.cpp | 2 +- lib/Frontend/TestModuleFileExtension.h | 2 +- lib/Serialization/ASTReader.cpp | 2 +- lib/Serialization/ASTReaderDecl.cpp | 2 +- lib/Serialization/ASTReaderStmt.cpp | 2 +- lib/Serialization/ASTWriter.cpp | 4 ++-- lib/Serialization/ASTWriterDecl.cpp | 2 +- lib/Serialization/ASTWriterStmt.cpp | 2 +- lib/Serialization/CMakeLists.txt | 1 + lib/Serialization/GeneratePCH.cpp | 2 +- lib/Serialization/GlobalModuleIndex.cpp | 4 ++-- lib/Serialization/PCHContainerOperations.cpp | 2 +- tools/libclang/CXLoadedDiagnostic.cpp | 2 +- unittests/Serialization/CMakeLists.txt | 1 + 25 files changed, 28 insertions(+), 25 deletions(-) diff --git a/include/clang/Frontend/SerializedDiagnosticPrinter.h b/include/clang/Frontend/SerializedDiagnosticPrinter.h index 5c1ff7a031..58954dc6ba 100644 --- a/include/clang/Frontend/SerializedDiagnosticPrinter.h +++ b/include/clang/Frontend/SerializedDiagnosticPrinter.h @@ -11,7 +11,7 @@ #include "clang/Basic/LLVM.h" #include "clang/Frontend/SerializedDiagnostics.h" -#include "llvm/Bitcode/BitstreamWriter.h" +#include "llvm/Bitstream/BitstreamWriter.h" namespace llvm { class raw_ostream; diff --git a/include/clang/Frontend/SerializedDiagnosticReader.h b/include/clang/Frontend/SerializedDiagnosticReader.h index 7b3a6dbac1..309e0abb14 100644 --- a/include/clang/Frontend/SerializedDiagnosticReader.h +++ b/include/clang/Frontend/SerializedDiagnosticReader.h @@ -10,7 +10,7 @@ #define LLVM_CLANG_FRONTEND_SERIALIZEDDIAGNOSTICREADER_H #include "clang/Basic/LLVM.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ErrorOr.h" #include diff --git a/include/clang/Frontend/SerializedDiagnostics.h b/include/clang/Frontend/SerializedDiagnostics.h index 6ffcf520bc..4e67fd13ac 100644 --- a/include/clang/Frontend/SerializedDiagnostics.h +++ b/include/clang/Frontend/SerializedDiagnostics.h @@ -9,7 +9,7 @@ #ifndef LLVM_CLANG_FRONTEND_SERIALIZE_DIAGNOSTICS_H_ #define LLVM_CLANG_FRONTEND_SERIALIZE_DIAGNOSTICS_H_ -#include "llvm/Bitcode/BitCodes.h" +#include "llvm/Bitstream/BitCodes.h" namespace clang { namespace serialized_diags { diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index ff5039ff6c..ee545c7186 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -23,7 +23,7 @@ #include "clang/Basic/OperatorKinds.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/DenseMapInfo.h" -#include "llvm/Bitcode/BitCodes.h" +#include "llvm/Bitstream/BitCodes.h" #include #include diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index b299947c18..37bea48d88 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -56,7 +56,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/iterator.h" #include "llvm/ADT/iterator_range.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Endian.h" #include "llvm/Support/MemoryBuffer.h" diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index 1a87be231d..76bd874fb0 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -36,7 +36,7 @@ #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Bitcode/BitstreamWriter.h" +#include "llvm/Bitstream/BitstreamWriter.h" #include #include #include diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h index ebaaeea29a..1979c53a71 100644 --- a/include/clang/Serialization/Module.h +++ b/include/clang/Serialization/Module.h @@ -24,7 +24,7 @@ #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/Support/Endian.h" #include #include diff --git a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index db6e73f409..15a2ab99fd 100644 --- a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -21,7 +21,7 @@ #include "clang/Lex/HeaderSearch.h" #include "clang/Lex/Preprocessor.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/DebugInfo/DWARF/DWARFContext.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index ee36caaebc..7445a94cfe 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -75,7 +75,7 @@ #include "llvm/ADT/StringSet.h" #include "llvm/ADT/Twine.h" #include "llvm/ADT/iterator_range.h" -#include "llvm/Bitcode/BitstreamWriter.h" +#include "llvm/Bitstream/BitstreamWriter.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CrashRecoveryContext.h" diff --git a/lib/Frontend/CMakeLists.txt b/lib/Frontend/CMakeLists.txt index c23ab1e7fe..fbc3487d43 100644 --- a/lib/Frontend/CMakeLists.txt +++ b/lib/Frontend/CMakeLists.txt @@ -2,6 +2,7 @@ add_subdirectory(Rewrite) set(LLVM_LINK_COMPONENTS BitReader + BitstreamReader Option ProfileData Support diff --git a/lib/Frontend/SerializedDiagnosticReader.cpp b/lib/Frontend/SerializedDiagnosticReader.cpp index c60dd6c1ef..045d757adb 100644 --- a/lib/Frontend/SerializedDiagnosticReader.cpp +++ b/lib/Frontend/SerializedDiagnosticReader.cpp @@ -13,8 +13,8 @@ #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Bitcode/BitCodes.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitCodes.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorOr.h" diff --git a/lib/Frontend/TestModuleFileExtension.cpp b/lib/Frontend/TestModuleFileExtension.cpp index f8ed341934..354aa7f5cd 100644 --- a/lib/Frontend/TestModuleFileExtension.cpp +++ b/lib/Frontend/TestModuleFileExtension.cpp @@ -9,7 +9,7 @@ #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Serialization/ASTReader.h" #include "llvm/ADT/Hashing.h" -#include "llvm/Bitcode/BitstreamWriter.h" +#include "llvm/Bitstream/BitstreamWriter.h" #include "llvm/Support/raw_ostream.h" #include using namespace clang; diff --git a/lib/Frontend/TestModuleFileExtension.h b/lib/Frontend/TestModuleFileExtension.h index 6c28e9cb68..13e090783b 100644 --- a/lib/Frontend/TestModuleFileExtension.h +++ b/lib/Frontend/TestModuleFileExtension.h @@ -11,7 +11,7 @@ #include "clang/Serialization/ModuleFileExtension.h" #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamReader.h" #include namespace clang { diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 0d8209c01c..c3f3a370ef 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -101,7 +101,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/ADT/iterator_range.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Compression.h" diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index bd7880c339..a2b80999e6 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -57,7 +57,7 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/iterator_range.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/SaveAndRestore.h" diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp index 58103eaf9a..51a1e81525 100644 --- a/lib/Serialization/ASTReaderStmt.cpp +++ b/lib/Serialization/ASTReaderStmt.cpp @@ -52,7 +52,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index c60e2da20f..218983c732 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -83,8 +83,8 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Bitcode/BitCodes.h" -#include "llvm/Bitcode/BitstreamWriter.h" +#include "llvm/Bitstream/BitCodes.h" +#include "llvm/Bitstream/BitstreamWriter.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Compression.h" #include "llvm/Support/DJB.h" diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index eb709f59c9..f52fc014bb 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -21,7 +21,7 @@ #include "clang/Basic/SourceManager.h" #include "clang/Serialization/ASTReader.h" #include "clang/Serialization/ASTWriter.h" -#include "llvm/Bitcode/BitstreamWriter.h" +#include "llvm/Bitstream/BitstreamWriter.h" #include "llvm/Support/ErrorHandling.h" using namespace clang; using namespace serialization; diff --git a/lib/Serialization/ASTWriterStmt.cpp b/lib/Serialization/ASTWriterStmt.cpp index 486cc14e6b..4fbcbaabe7 100644 --- a/lib/Serialization/ASTWriterStmt.cpp +++ b/lib/Serialization/ASTWriterStmt.cpp @@ -18,7 +18,7 @@ #include "clang/AST/DeclTemplate.h" #include "clang/AST/StmtVisitor.h" #include "clang/Lex/Token.h" -#include "llvm/Bitcode/BitstreamWriter.h" +#include "llvm/Bitstream/BitstreamWriter.h" using namespace clang; //===----------------------------------------------------------------------===// diff --git a/lib/Serialization/CMakeLists.txt b/lib/Serialization/CMakeLists.txt index 3d24c571f3..ab90635d2b 100644 --- a/lib/Serialization/CMakeLists.txt +++ b/lib/Serialization/CMakeLists.txt @@ -1,5 +1,6 @@ set(LLVM_LINK_COMPONENTS BitReader + BitstreamReader Support ) diff --git a/lib/Serialization/GeneratePCH.cpp b/lib/Serialization/GeneratePCH.cpp index 6d98524636..002233e49b 100644 --- a/lib/Serialization/GeneratePCH.cpp +++ b/lib/Serialization/GeneratePCH.cpp @@ -16,7 +16,7 @@ #include "clang/Lex/Preprocessor.h" #include "clang/Sema/SemaConsumer.h" #include "clang/Serialization/ASTWriter.h" -#include "llvm/Bitcode/BitstreamWriter.h" +#include "llvm/Bitstream/BitstreamWriter.h" using namespace clang; diff --git a/lib/Serialization/GlobalModuleIndex.cpp b/lib/Serialization/GlobalModuleIndex.cpp index 626eebbef9..f90eab3227 100644 --- a/lib/Serialization/GlobalModuleIndex.cpp +++ b/lib/Serialization/GlobalModuleIndex.cpp @@ -21,8 +21,8 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/MapVector.h" #include "llvm/ADT/SmallString.h" -#include "llvm/Bitcode/BitstreamReader.h" -#include "llvm/Bitcode/BitstreamWriter.h" +#include "llvm/Bitstream/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamWriter.h" #include "llvm/Support/DJB.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/LockFileManager.h" diff --git a/lib/Serialization/PCHContainerOperations.cpp b/lib/Serialization/PCHContainerOperations.cpp index 4c05ff951a..00063d64f3 100644 --- a/lib/Serialization/PCHContainerOperations.cpp +++ b/lib/Serialization/PCHContainerOperations.cpp @@ -13,7 +13,7 @@ #include "clang/Serialization/PCHContainerOperations.h" #include "clang/AST/ASTConsumer.h" #include "clang/Lex/ModuleLoader.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/Support/raw_ostream.h" #include diff --git a/tools/libclang/CXLoadedDiagnostic.cpp b/tools/libclang/CXLoadedDiagnostic.cpp index 551d8343fc..3bc658c4cb 100644 --- a/tools/libclang/CXLoadedDiagnostic.cpp +++ b/tools/libclang/CXLoadedDiagnostic.cpp @@ -20,7 +20,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" -#include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/Support/ErrorHandling.h" using namespace clang; diff --git a/unittests/Serialization/CMakeLists.txt b/unittests/Serialization/CMakeLists.txt index c7ec9a4f07..a19ef5faee 100644 --- a/unittests/Serialization/CMakeLists.txt +++ b/unittests/Serialization/CMakeLists.txt @@ -1,5 +1,6 @@ set(LLVM_LINK_COMPONENTS BitReader + BitstreamReader Support ) -- 2.40.0