-
Notifications
You must be signed in to change notification settings - Fork 295
Fix compat with Clang 22 #1671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix compat with Clang 22 #1671
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -656,6 +656,7 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> { | |
| VisitQualType(t); | ||
| } | ||
|
|
||
| #if CLANG_VERSION_MAJOR < 22 | ||
| void VisitElaboratedType(const ElaboratedType *T) { | ||
| auto t = T->desugar(); | ||
| auto qt = encodeQualType(t); | ||
|
|
@@ -664,6 +665,7 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> { | |
|
|
||
| VisitQualType(t); | ||
| } | ||
| #endif | ||
|
|
||
| void VisitDecayedType(const DecayedType *T) { | ||
| auto t = T->desugar(); | ||
|
|
@@ -673,6 +675,16 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> { | |
|
|
||
| VisitQualType(t); | ||
| } | ||
|
|
||
| #if CLANG_VERSION_MAJOR >= 22 | ||
| void VisitPredefinedSugarType(const clang::PredefinedSugarType *T) { | ||
| auto t = T->desugar(); | ||
| auto k = T->getKind(); | ||
| encodeType(T, TagPredefinedSugarType, | ||
| [k](CborEncoder *local) { cbor_encode_uint(local, uint64_t(k)); }); | ||
| VisitQualType(t); | ||
| } | ||
| #endif | ||
| }; | ||
|
|
||
| class TranslateASTVisitor final | ||
|
|
@@ -2224,8 +2236,6 @@ class TranslateASTVisitor final | |
| auto recordAlignment = 0; | ||
| auto byteSize = 0; | ||
|
|
||
| auto t = D->getTypeForDecl(); | ||
|
|
||
|
Comment on lines
-2227
to
-2228
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are unused and the |
||
| auto loc = D->getSourceRange(); | ||
| std::vector<void *> childIds; | ||
| if (def) { | ||
|
|
@@ -2305,8 +2315,6 @@ class TranslateASTVisitor final | |
| // They are used in actual code and accepted by compilers, so we cannot | ||
| // exit early via code like `if (!D->isCompleteDefinition()) return true;`. | ||
|
|
||
| auto t = D->getTypeForDecl(); | ||
|
|
||
| std::vector<void *> childIds; | ||
| for (auto x : D->enumerators()) { | ||
| childIds.push_back(x->getCanonicalDecl()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,6 +151,7 @@ enum TypeTag { | |
|
|
||
| TagFloat128, | ||
| TagAtomicType, | ||
| TagPredefinedSugarType, | ||
| }; | ||
|
|
||
| enum StringTypeTag { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -813,6 +813,21 @@ impl ConversionContext { | |
| self.processed_nodes.insert(new_id, expected_ty); | ||
| } | ||
|
|
||
| TypeTag::TagPredefinedSugarType => { | ||
| let kind = from_value(ty_node.extras[0].clone()) | ||
| .expect("Predefined sugar type kind not found"); | ||
|
|
||
| // See `clang::PredefinedSugarKind`. | ||
| let predef_sugar_ty = match kind { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this affect the portable type code?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 0 => CTypeKind::Size, | ||
| 1 => CTypeKind::SSize, | ||
| 2 => CTypeKind::PtrDiff, | ||
| _ => panic!("Predefined sugar type kind {kind} not known"), | ||
| }; | ||
| self.add_type(new_id, not_located(predef_sugar_ty)); | ||
| self.processed_nodes.insert(new_id, expected_ty); | ||
| } | ||
|
|
||
| TypeTag::TagEnumType if expected_ty & OTHER_TYPE != 0 => { | ||
| let decl = from_value(ty_node.extras[0].clone()).expect("Enum decl not found"); | ||
| let decl_new = CDeclId(self.visit_node_type(decl, ENUM_DECL)); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we indent preprocessor directives? In most projects, they start at column 1.