Skip to content

Commit 23da910

Browse files
committed
refactor serializer
1 parent 6e1c1fd commit 23da910

File tree

5 files changed

+634
-420
lines changed

5 files changed

+634
-420
lines changed

source/lib/ast/BitcodeIDs.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct BitCodeConstants
3636
static constexpr unsigned USRLengthSize = 6U;
3737
static constexpr unsigned USRBitLengthSize = 8U;
3838
static constexpr unsigned USRHashSize = 20;
39-
static constexpr unsigned char Signature[4] = {'D', 'O', 'C', 'S'};
39+
static constexpr unsigned char Signature[4] = {'M', 'R', 'D', 'X'};
4040
};
4141

4242
/** List of block identifiers.

source/lib/ast/BitcodeWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ dispatchInfoForWrite(Info const* I)
345345

346346
// Validation and Overview Blocks
347347

348-
/// Emits the magic number header to check that its the right format,
349-
/// in this case, 'DOCS'.
348+
/// Emits the magic number header to check
349+
/// that its the right format, in this case, 'DOCS'.
350350
void
351351
BitcodeWriter::
352352
emitHeader()

source/lib/ast/FrontendAction.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,22 +116,22 @@ mapDecl(T const* D)
116116
// VFALCO is this right?
117117
bool const IsFileInRootDir = true;
118118

119-
Serializer sr(
119+
auto res = serialize(
120+
D,
120121
getLine(D, D->getASTContext()),
121122
filePath,
122123
IsFileInRootDir,
123124
config_,
124125
R_);
125-
auto I = sr.buildInfoPair(D);
126-
127-
// A null in place of I indicates that the
128-
// serializer is skipping this decl for some
129-
// reason (e.g. we're only reporting public decls).
130-
if (I.first)
131-
Corpus::reportResult(ex_, I.first->USR, serialize(*I.first));
132-
if (I.second)
133-
Corpus::reportResult(ex_, I.second->USR, serialize(*I.second));
134126

127+
// An empty serialized declaration means that
128+
// the serializer is skipping this declaration
129+
// for some reason. For example it is private,
130+
// or the declaration is enclosed in the parent.
131+
if(! res.first.empty())
132+
Corpus::reportResult(ex_, res.first.id, std::move(res.first.bitcode));
133+
if(! res.second.empty())
134+
Corpus::reportResult(ex_, res.second.id, std::move(res.second.bitcode));
135135
return true;
136136
}
137137

0 commit comments

Comments
 (0)