Skip to content

Commit e6205d5

Browse files
committed
refactor: drop bitcode support
1 parent 8537d3d commit e6205d5

18 files changed

+23
-4688
lines changed

.github/check_info_nodes_support.sh

-23
Original file line numberDiff line numberDiff line change
@@ -109,29 +109,6 @@ while IFS= read -r line; do
109109
print_message "* \`build$name()\` not found in \`src/lib/AST/ASTVisitor.cpp\`"
110110
fi
111111

112-
# `src/lib/AST/AnyBlock.hpp` should define the `${name}Block` type
113-
# Look for the string `${name}Block` in the file
114-
if ! grep -q "${name}Block" "$MRDOCS_ROOT/src/lib/AST/AnyBlock.hpp"; then
115-
print_message_once "## ${name}Info"
116-
print_message "* \`${name}Block\` not found in \`src/lib/AST/AnyBlock.hpp\`"
117-
fi
118-
119-
# `src/lib/AST/BitcodeWriter.hpp` should define `void emitBlock(X const& I);`
120-
# Look for the string `void emitBlock(${name}Info const& I);` in the file
121-
# When looking for the string `void emitBlock(${name}Info const& I);` in the file,
122-
# we need to use regex to account for the following:
123-
# 1) Remove the leading and trailing spaces
124-
# 2) Consecutive spaces should be replaced with a single space
125-
# 3) Newlines should be removed
126-
# 4) The variable name `I` can be anything
127-
BITCODE_WRITE_REL_PATH="src/lib/AST/BitcodeWriter.hpp"
128-
BITCODE_WRITE_PATH="$MRDOCS_ROOT/$BITCODE_WRITE_REL_PATH"
129-
regex="void[[:space:]]+emitBlock[[:space:]]*\(${name}Info[[:space:]]*const[[:space:]]*&[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*[[:space:]]*\);"
130-
if ! grep -Pzo "$regex" "$BITCODE_WRITE_PATH" > /dev/null; then
131-
print_message_once "## ${name}Info"
132-
print_message "The function \`void emitBlock(${name}Info const& I);\` is not defined in \`$BITCODE_WRITE_REL_PATH\`."
133-
fi
134-
135112
# `src/lib/Gen/xml/XMLWriter.cpp` should define `XMLWriter::writeX()`
136113
# Just look for the string `write$name` in this file
137114
if ! grep -q "write$name" "$MRDOCS_ROOT/src/lib/Gen/xml/XMLWriter.cpp"; then

docs/modules/ROOT/pages/contribute.adoc

+3-9
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ include::partial$InfoNodes.inc[]
105105
`Info` can not only represent direct AST symbols but also {cpp} constructs that need to be inferred from these symbols.
106106
Nodes in the first category will typically be created in the initial extraction step, and nodes in the second category will be created in the finalization step.
107107

108-
When defining a new `Info` type, it is important to consider how this type will be supported in all other modules of the codebase, including the AST visitor, the bitcode writer, generators, tests, and the documentation.
108+
When defining a new `Info` type, it is important to consider how this type will be supported in all other modules of the codebase, including the AST visitor, generators, tests, and the documentation.
109109
The script `.github/check_info_nodes_support.sh` will attempt to infer whether most of these features have been implemented for each node type.
110110

111111
==== Clang LibTooling
@@ -145,19 +145,13 @@ It is during this stage that USRs (universal symbol references) are generated an
145145
Except for built-in types, *all* entities referenced in the corpus will be traversed and be assigned a `SymbolID`; including those from the standard library.
146146
This is necessary to generate the full interface for user-defined types.
147147

148-
==== Bitcode
149-
150-
To maximize the size of the code base MrDocs is capable of processing, `Info`
151-
types generated during traversal are serialized to a compressed bitcode representation.
152-
153-
The `ASTVisitor` reports each new `Info` object to the `BitcodeExecutionContext` (`src/lib/Lib/ExecutionContext.cpp`) which serializes it to the bitcode file.
154-
155148
==== Finalizing the Corpus
156149

157150
After running the AST traversal on all translation units, `CorpusImpl::build` contains finalization steps for the `Corpus` object.
158151
At this point, we process C++ constructs that are not directly represented in the AST.
159152

160-
The first finalization step happens in `BitcodeExecutionContext::reportEnd` (`src/lib/Lib/ExecutionContext.cpp`), where the `Info` objects with the same `SymbolID` are merged.
153+
The first finalization step happens in `CorpusImpl::build` (`src/lib/Lib/CorpusImpl.cpp`), where the `Info` objects from a single translation unit
154+
are merged into a map containing the merged results from all other TUs.
161155
The merging step is necessary as there may be multiple identical definitions of the same entity.
162156
For instance, this represents the case where a function is declared at different points in the code base and might have different attributes or comments.
163157
At this step, the doc comments are also finalized.

include/mrdocs/Metadata/Javadoc.hpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ using List = std::vector<std::unique_ptr<T>>;
9090
of the the doc comment specification.
9191
9292
@note When a new tag is added, the `visit` function overloads
93-
must be updated to handle the new tag. If the new object
94-
contains new fields, `BitcodeWriter::emitBlock(doc::Node const& I)`
95-
must include logic to serialize the new fields, and
96-
`BitcodeReader::readBlock` must include logic to deserialize
97-
the new fields.
93+
must be updated to handle the new tag.
9894
9995
@see https://en.wikipedia.org/wiki/Javadoc[Javadoc - Wikipedia]
10096
@see https://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/javadoc.html[Javadoc Documentation]

src/lib/AST/ASTVisitor.cpp

+5-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
#include "ASTVisitor.hpp"
1414
#include "ASTVisitorHelpers.hpp"
15-
#include "Bitcode.hpp"
1615
#include "ParseJavadoc.hpp"
1716
#include "lib/Support/Path.hpp"
1817
#include "lib/Support/Debug.hpp"
@@ -163,17 +162,11 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
163162
//
164163
//------------------------------------------------
165164

166-
/** Convert AST to our metadata and serialize to bitcode.
167-
168-
An instance of this object visits the AST
169-
for exactly one translation unit. The AST is
170-
extracted and converted into our metadata, and
171-
this metadata is then serialized into bitcode.
172-
The resulting bitcode is inserted into the tool
173-
results, keyed by ID. Each ID can have multiple
174-
serialized bitcodes, as the same declaration
175-
in a particular include file can be seen by
176-
more than one translation unit.
165+
/** Convert AST to metadata representation.
166+
167+
An instance of this object traverses the AST
168+
for a translation unit and translate AST nodes
169+
into our metadata.
177170
*/
178171
class ASTVisitor
179172
{

0 commit comments

Comments
 (0)