Skip to content

Commit 01452ce

Browse files
committed
final change
1 parent d9a96ac commit 01452ce

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

clang/include/clang/AST/ASTContext.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2803,12 +2803,6 @@ class ASTContext : public RefCountedBase<ASTContext> {
28032803
return getUnqualifiedArrayType(T, Quals);
28042804
}
28052805

2806-
// Determine whether an array is a valid return type
2807-
// Array is a valid return type for HLSL
2808-
bool isReturnableArrayType(QualType T) const {
2809-
return T->isArrayType() && getLangOpts().HLSL;
2810-
}
2811-
28122806
/// Determine whether the given types are equivalent after
28132807
/// cvr-qualifiers have been removed.
28142808
bool hasSameUnqualifiedType(QualType T1, QualType T2) const {

clang/include/clang/Basic/LangOptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,8 @@ class LangOptions : public LangOptionsBase {
816816
VisibilityForcedKinds::ForceHidden;
817817
}
818818

819+
bool allowArrayReturnTypes() const { return HLSL; }
820+
819821
/// Remap path prefix according to -fmacro-prefix-path option.
820822
void remapPathPrefix(SmallVectorImpl<char> &Path) const;
821823

clang/lib/Sema/SemaExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20681,7 +20681,7 @@ ExprResult RebuildUnknownAnyExpr::VisitCallExpr(CallExpr *E) {
2068120681
const FunctionType *FnType = CalleeType->castAs<FunctionType>();
2068220682

2068320683
// Verify that this is a legal result type of a function.
20684-
if ((DestType->isArrayType() && !S.Context.isReturnableArrayType(DestType)) ||
20684+
if ((DestType->isArrayType() && !S.getLangOpts().allowArrayReturnTypes()) ||
2068520685
DestType->isFunctionType()) {
2068620686
unsigned diagID = diag::err_func_returning_array_function;
2068720687
if (Kind == FK_BlockPointer)

clang/lib/Sema/SemaType.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,7 +2530,7 @@ QualType Sema::BuildMatrixType(QualType ElementTy, Expr *NumRows, Expr *NumCols,
25302530
}
25312531

25322532
bool Sema::CheckFunctionReturnType(QualType T, SourceLocation Loc) {
2533-
if ((T->isArrayType() && !Context.isReturnableArrayType(T)) ||
2533+
if ((T->isArrayType() && !getLangOpts().allowArrayReturnTypes()) ||
25342534
T->isFunctionType()) {
25352535
Diag(Loc, diag::err_func_returning_array_function)
25362536
<< T->isFunctionType() << T;
@@ -4936,7 +4936,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
49364936
// C99 6.7.5.3p1: The return type may not be a function or array type.
49374937
// For conversion functions, we'll diagnose this particular error later.
49384938
if (!D.isInvalidType() &&
4939-
((T->isArrayType() && !S.Context.isReturnableArrayType(T)) ||
4939+
((T->isArrayType() && !S.getLangOpts().allowArrayReturnTypes()) ||
49404940
T->isFunctionType()) &&
49414941
(D.getName().getKind() !=
49424942
UnqualifiedIdKind::IK_ConversionFunctionId)) {

0 commit comments

Comments
 (0)