forked from bartvdbraak/blender
Brecht Van Lommel
3c14f02eac
Note these are intended for platform maintainers, we do not intend to support users making their own builds with these. For that precompiled libraries from lib/ should be used. Implemented by Martijn Berger, Ray Molenkamp and Brecht Van Lommel. Differential Revision: https://developer.blender.org/D2753
128 lines
5.0 KiB
Diff
128 lines
5.0 KiB
Diff
--- cfe/trunk/lib/Serialization/ASTWriter.cpp
|
|
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp
|
|
@@ -56,14 +56,14 @@
|
|
using namespace clang::serialization;
|
|
|
|
template <typename T, typename Allocator>
|
|
-static StringRef bytes(const std::vector<T, Allocator> &v) {
|
|
+static StringRef data(const std::vector<T, Allocator> &v) {
|
|
if (v.empty()) return StringRef();
|
|
return StringRef(reinterpret_cast<const char*>(&v[0]),
|
|
sizeof(T) * v.size());
|
|
}
|
|
|
|
template <typename T>
|
|
-static StringRef bytes(const SmallVectorImpl<T> &v) {
|
|
+static StringRef data(const SmallVectorImpl<T> &v) {
|
|
return StringRef(reinterpret_cast<const char*>(v.data()),
|
|
sizeof(T) * v.size());
|
|
}
|
|
@@ -1385,7 +1385,7 @@
|
|
Record.push_back(INPUT_FILE_OFFSETS);
|
|
Record.push_back(InputFileOffsets.size());
|
|
Record.push_back(UserFilesNum);
|
|
- Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record, bytes(InputFileOffsets));
|
|
+ Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record, data(InputFileOffsets));
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
@@ -1771,7 +1771,7 @@
|
|
Record.push_back(SOURCE_LOCATION_OFFSETS);
|
|
Record.push_back(SLocEntryOffsets.size());
|
|
Record.push_back(SourceMgr.getNextLocalOffset() - 1); // skip dummy
|
|
- Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record, bytes(SLocEntryOffsets));
|
|
+ Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record, data(SLocEntryOffsets));
|
|
|
|
// Write the source location entry preloads array, telling the AST
|
|
// reader which source locations entries it should load eagerly.
|
|
@@ -2087,7 +2087,7 @@
|
|
Record.push_back(MacroOffsets.size());
|
|
Record.push_back(FirstMacroID - NUM_PREDEF_MACRO_IDS);
|
|
Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record,
|
|
- bytes(MacroOffsets));
|
|
+ data(MacroOffsets));
|
|
}
|
|
|
|
void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
|
|
@@ -2185,7 +2185,7 @@
|
|
Record.push_back(PPD_ENTITIES_OFFSETS);
|
|
Record.push_back(FirstPreprocessorEntityID - NUM_PREDEF_PP_ENTITY_IDS);
|
|
Stream.EmitRecordWithBlob(PPEOffsetAbbrev, Record,
|
|
- bytes(PreprocessedEntityOffsets));
|
|
+ data(PreprocessedEntityOffsets));
|
|
}
|
|
}
|
|
|
|
@@ -2548,7 +2548,7 @@
|
|
Record.push_back(CXX_BASE_SPECIFIER_OFFSETS);
|
|
Record.push_back(CXXBaseSpecifiersOffsets.size());
|
|
Stream.EmitRecordWithBlob(BaseSpecifierOffsetAbbrev, Record,
|
|
- bytes(CXXBaseSpecifiersOffsets));
|
|
+ data(CXXBaseSpecifiersOffsets));
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
@@ -2623,7 +2623,7 @@
|
|
Decls.push_back(std::make_pair((*D)->getKind(), GetDeclRef(*D)));
|
|
|
|
++NumLexicalDeclContexts;
|
|
- Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record, bytes(Decls));
|
|
+ Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record, data(Decls));
|
|
return Offset;
|
|
}
|
|
|
|
@@ -2642,7 +2642,7 @@
|
|
Record.push_back(TYPE_OFFSET);
|
|
Record.push_back(TypeOffsets.size());
|
|
Record.push_back(FirstTypeID - NUM_PREDEF_TYPE_IDS);
|
|
- Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, bytes(TypeOffsets));
|
|
+ Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, data(TypeOffsets));
|
|
|
|
// Write the declaration offsets array
|
|
Abbrev = new BitCodeAbbrev();
|
|
@@ -2655,7 +2655,7 @@
|
|
Record.push_back(DECL_OFFSET);
|
|
Record.push_back(DeclOffsets.size());
|
|
Record.push_back(FirstDeclID - NUM_PREDEF_DECL_IDS);
|
|
- Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, bytes(DeclOffsets));
|
|
+ Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, data(DeclOffsets));
|
|
}
|
|
|
|
void ASTWriter::WriteFileDeclIDsMap() {
|
|
@@ -2680,7 +2680,7 @@
|
|
unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);
|
|
Record.push_back(FILE_SORTED_DECLS);
|
|
Record.push_back(FileSortedIDs.size());
|
|
- Stream.EmitRecordWithBlob(AbbrevCode, Record, bytes(FileSortedIDs));
|
|
+ Stream.EmitRecordWithBlob(AbbrevCode, Record, data(FileSortedIDs));
|
|
}
|
|
|
|
void ASTWriter::WriteComments() {
|
|
@@ -2893,7 +2893,7 @@
|
|
Record.push_back(SelectorOffsets.size());
|
|
Record.push_back(FirstSelectorID - NUM_PREDEF_SELECTOR_IDS);
|
|
Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,
|
|
- bytes(SelectorOffsets));
|
|
+ data(SelectorOffsets));
|
|
}
|
|
}
|
|
|
|
@@ -3253,7 +3253,7 @@
|
|
Record.push_back(IdentifierOffsets.size());
|
|
Record.push_back(FirstIdentID - NUM_PREDEF_IDENT_IDS);
|
|
Stream.EmitRecordWithBlob(IdentifierOffsetAbbrev, Record,
|
|
- bytes(IdentifierOffsets));
|
|
+ data(IdentifierOffsets));
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
@@ -4046,7 +4046,7 @@
|
|
Record.clear();
|
|
Record.push_back(TU_UPDATE_LEXICAL);
|
|
Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,
|
|
- bytes(NewGlobalDecls));
|
|
+ data(NewGlobalDecls));
|
|
|
|
// And a visible updates block for the translation unit.
|
|
Abv = new llvm::BitCodeAbbrev();
|