File tree 3 files changed +21
-1
lines changed
include/swift/ClangImporter
3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,11 @@ class DataStreamBasicReader
89
89
clang::QualType type = asImpl ().readTypeRef ();
90
90
return getASTContext ().getQualifiedType (type, quals);
91
91
}
92
+
93
+ const clang::BTFTypeTagAttr *readBTFTypeTagAttr () {
94
+ llvm::report_fatal_error (" Read BTFTypeTagAttr that should never have been"
95
+ " serialized" );
96
+ }
92
97
};
93
98
94
99
}
Original file line number Diff line number Diff line change 21
21
#define SWIFT_CLANGIMPORTER_SWIFTABSTRACTBASICWRITER_H
22
22
23
23
#include " clang/AST/AbstractTypeWriter.h"
24
+ #include " clang/AST/Type.h"
24
25
25
26
namespace swift {
26
27
@@ -80,11 +81,24 @@ class DataStreamBasicWriter
80
81
assert (!type.isNull ());
81
82
82
83
auto split = type.split ();
83
- asImpl (). writeQualifiers ( split.Quals ) ;
84
+ auto qualifiers = split.Quals ;
84
85
86
+ // Unwrap BTFTagAttributeType and merge any of its qualifiers.
87
+ while (auto btfType = dyn_cast<clang::BTFTagAttributedType>(split.Ty )) {
88
+ split = btfType->getWrappedType ().split ();
89
+ qualifiers.addQualifiers (split.Quals );
90
+ }
91
+
92
+ asImpl ().writeQualifiers (qualifiers);
85
93
// Just recursively visit the given type.
86
94
asImpl ().writeTypeRef (split.Ty );
87
95
}
96
+
97
+ void writeBTFTypeTagAttr (const clang::BTFTypeTagAttr *attr) {
98
+ // BTFTagAttributeType is explicitly unwrapped above, so we should never
99
+ // hit any of its attributes.
100
+ llvm::report_fatal_error (" Should never hit BTFTypeTagAttr serialization" );
101
+ }
88
102
};
89
103
90
104
}
Original file line number Diff line number Diff line change @@ -930,6 +930,7 @@ namespace {
930
930
SUGAR_TYPE (SubstTemplateTypeParm)
931
931
SUGAR_TYPE (Elaborated)
932
932
SUGAR_TYPE (Using)
933
+ SUGAR_TYPE (BTFTagAttributed)
933
934
934
935
ImportResult VisitDecayedType (const clang::DecayedType *type) {
935
936
clang::ASTContext &clangCtx = Impl.getClangASTContext ();
You can’t perform that action at this time.
0 commit comments