Skip to content

Commit 50f5cb3

Browse files
committed
ast-exported: visit and encode AutoType nodes
1 parent 35eee04 commit 50f5cb3

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

c2rust-ast-exporter/src/AstExporter.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,22 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> {
674674

675675
VisitQualType(t);
676676
}
677+
678+
void VisitAutoType(const AutoType *T) {
679+
if (!T->isGNUAutoType()) {
680+
printDiag(Context, DiagnosticsEngine::Warning,
681+
"Encountered unexpected auto type",
682+
src_loc, src_range);
683+
return;
684+
}
685+
686+
auto t = T->desugar();
687+
auto qt = encodeQualType(t);
688+
encodeType(T, TagAutoType,
689+
[qt](CborEncoder *local) { cbor_encode_uint(local, qt); });
690+
691+
VisitQualType(t);
692+
}
677693
};
678694

679695
class TranslateASTVisitor final

c2rust-ast-exporter/src/ast_tags.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ enum TypeTag {
152152

153153
TagFloat128,
154154
TagAtomicType,
155+
156+
TagAutoType,
155157
};
156158

157159
enum StringTypeTag {

0 commit comments

Comments
 (0)