Skip to content
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

[AST] Fix inconsistencies in handling of Hyperobject types in the AST. #286

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clang/include/clang/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
return CanQualType::CreateUnsafe(getComplexType((QualType) T));
}

QualType getHyperobjectType(QualType T, Expr *R, Expr *I) const;
CanQualType getHyperobjectType(CanQualType T, Expr *R, Expr *I) const {
return CanQualType::CreateUnsafe(getHyperobjectType((QualType) T, R, I));
QualType getHyperobjectType(QualType T, Expr *I, Expr *R) const;
CanQualType getHyperobjectType(CanQualType T, Expr *I, Expr *R) const {
return CanQualType::CreateUnsafe(getHyperobjectType((QualType) T, I, R));
}

/// Return the uniqued reference to the type for a pointer to
Expand Down
8 changes: 4 additions & 4 deletions clang/include/clang/AST/TypeProperties.td
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ let Class = HyperobjectType in {
def : Property<"elementType", QualType> {
let Read = [{ node->getElementType() }];
}
def : Property<"reduce", ExprRef> {
let Read = [{ node->getReduce() }];
}
def : Property<"identity", ExprRef> {
let Read = [{ node->getIdentity() }];
}
def : Property<"reduce", ExprRef> {
let Read = [{ node->getReduce() }];
}

def : Creator<[{
return ctx.getHyperobjectType(elementType, reduce, identity);
return ctx.getHyperobjectType(elementType, identity, reduce);
}]>;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/ASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ ExpectedType ASTNodeImporter::VisitHyperobjectType(const HyperobjectType *T) {
return ToReduceOrErr.takeError();

return Importer.getToContext().getHyperobjectType(
*ToElementTypeOrErr, *ToReduceOrErr, *ToIdentityOrErr);
*ToElementTypeOrErr, *ToIdentityOrErr, *ToReduceOrErr);
}

ExpectedType ASTNodeImporter::VisitComplexType(const ComplexType *T) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/ASTStructuralEquivalence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
const HyperobjectType *H2 = cast<HyperobjectType>(T2);
Expr *R1 = H1->getReduce(), *R2 = H2->getReduce();
Expr *I1 = H1->getIdentity(), *I2 = H2->getIdentity();
if (!!I2 != !!I2 || !!R1 != !!R2)
if (!!I1 != !!I2 || !!R1 != !!R2)
return false;
if (I1 && !IsStructurallyEquivalent(Context, I1, I2))
return false;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/TreeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -1272,8 +1272,8 @@ class TreeTransform {
QualType RebuildDependentBitIntType(bool IsUnsigned, Expr *NumBitsExpr,
SourceLocation Loc);

QualType RebuildHyperobjectType(QualType ElementType, Expr *R,
Expr *I, SourceLocation Loc);
QualType RebuildHyperobjectType(QualType ElementType, Expr *I,
Expr *R, SourceLocation Loc);

/// Build a new template name given a nested name specifier, a flag
/// indicating whether the "template" keyword was provided, and the template
Expand Down
Loading