// we need to consider storing both types (in ParmVarDecl)...
//
QualType parmDeclType = QualType::getFromOpaquePtr(PI.TypeInfo);
- if (const ArrayType *AT = parmDeclType->getAsArrayType())
+ if (const ArrayType *AT = parmDeclType->getAsArrayType()) {
+ // int x[restrict 4] -> int *restrict
parmDeclType = Context.getPointerType(AT->getElementType());
- else if (parmDeclType->isFunctionType())
+ parmDeclType = parmDeclType.getQualifiedType(AT->getIndexTypeQualifier());
+ } else if (parmDeclType->isFunctionType())
parmDeclType = Context.getPointerType(parmDeclType);
ParmVarDecl *New = new ParmVarDecl(PI.IdentLoc, II, parmDeclType,
// FIXME: If a source translation tool needs to see the original type,
// then we need to consider storing both types somewhere...
//
- if (const ArrayType *AT = ArgTy->getAsArrayType())
+ if (const ArrayType *AT = ArgTy->getAsArrayType()) {
+ // int x[restrict 4] -> int *restrict
ArgTy = Context.getPointerType(AT->getElementType());
- else if (ArgTy->isFunctionType())
+ ArgTy = ArgTy.getQualifiedType(AT->getIndexTypeQualifier());
+ } else if (ArgTy->isFunctionType())
ArgTy = Context.getPointerType(ArgTy);
// Look for 'void'. void is allowed only as a single argument to a
// function with no other parameters (C99 6.7.5.3p10). We record
--- /dev/null
+// RUN: clang %s -fsyntax-only
+// PR1892
+void f(double a[restrict][5]); // should promote to restrict ptr.
+void f(double (* restrict a)[5]);
+