Skip to content
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
5 changes: 3 additions & 2 deletions clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3902,7 +3902,8 @@ QualType ASTContext::getArrayParameterType(QualType Ty) const {
if (Ty->isArrayParameterType())
return Ty;
assert(Ty->isConstantArrayType() && "Ty must be an array type.");
const auto *ATy = cast<ConstantArrayType>(Ty.getDesugaredType(*this));
QualType DTy = Ty.getDesugaredType(*this);
const auto *ATy = cast<ConstantArrayType>(DTy);
llvm::FoldingSetNodeID ID;
ATy->Profile(ID, *this, ATy->getElementType(), ATy->getZExtSize(),
ATy->getSizeExpr(), ATy->getSizeModifier(),
Expand All @@ -3914,7 +3915,7 @@ QualType ASTContext::getArrayParameterType(QualType Ty) const {
return QualType(AT, 0);

QualType Canonical;
if (!Ty.isCanonical()) {
if (!DTy.isCanonical()) {
Canonical = getArrayParameterType(getCanonicalType(Ty));

// Get the new insert position for the node we care about.
Expand Down
11 changes: 11 additions & 0 deletions clang/test/AST/HLSL/TypdefArrayParam.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ void call2() {
uint4 C[2] = {A,A};
uint32_t D = Accumulate(C);
}

typedef int Foo[2];

// CHECK-LABEL: call3
// CHECK: ArraySubscriptExpr {{.*}} 'int' lvalue
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int *' <ArrayToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int[2]' lvalue ParmVar {{.*}} 'F' 'int[2]'
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 0
int call3(Foo F) {
return F[0];
}
Loading