Skip to content

Commit d43f324

Browse files
committed
[Sema][HLSL] Remove some duplicated code. NFC
1 parent ea32f99 commit d43f324

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10325,7 +10325,10 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
1032510325
return NewFD;
1032610326
}
1032710327

10328-
if (getLangOpts().OpenCL) {
10328+
if (getLangOpts().OpenCL || getLangOpts().HLSL) {
10329+
// Neither OpenCL nor HLSL allow an address space qualifyer on a return
10330+
// type.
10331+
//
1032910332
// OpenCL v1.1 s6.5: Using an address space qualifier in a function return
1033010333
// type declaration will generate a compilation error.
1033110334
LangAS AddressSpace = NewFD->getReturnType().getAddressSpace();
@@ -10360,13 +10363,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
1036010363
}
1036110364
}
1036210365
}
10363-
// HLSL does not support specifying an address space on a function return
10364-
// type.
10365-
LangAS AddressSpace = NewFD->getReturnType().getAddressSpace();
10366-
if (AddressSpace != LangAS::Default) {
10367-
Diag(NewFD->getLocation(), diag::err_return_value_with_address_space);
10368-
NewFD->setInvalidDecl();
10369-
}
1037010366
}
1037110367

1037210368
if (!getLangOpts().CPlusPlus) {

0 commit comments

Comments
 (0)