@@ -6888,42 +6888,6 @@ static void SetNestedNameSpecifier(Sema &S, DeclaratorDecl *DD, Declarator &D) {
68886888 DD->setQualifierInfo(SS.getWithLocInContext(S.Context));
68896889}
68906890
6891- void Sema::deduceHLSLAddressSpace(VarDecl *Decl) {
6892- // The variable already has an address space (groupshared for ex).
6893- if (Decl->getType().hasAddressSpace())
6894- return;
6895-
6896- if (Decl->getType()->isDependentType())
6897- return;
6898-
6899- QualType Type = Decl->getType();
6900- if (Type->isSamplerT() || Type->isVoidType())
6901- return;
6902-
6903- // Template instantiations can lack definition. In such case,
6904- // we cannot deduce the AS.
6905- // FIXME: figure out why RWBuffer<float> yields such declaration.
6906- if (const RecordType *RT =
6907- dyn_cast<RecordType>(Type->getUnqualifiedDesugaredType())) {
6908- CXXRecordDecl *RD = Type->getAsCXXRecordDecl();
6909- if (RD && !RD->isCompleteDefinition())
6910- return;
6911- }
6912-
6913- // Resource handles.
6914- if (Type->isHLSLIntangibleType())
6915- return;
6916-
6917- // Only static globals belong to the Private address space.
6918- // Non-static globals belongs to the cbuffer.
6919- if (Decl->getStorageClass() != SC_Static && !Decl->isStaticDataMember())
6920- return;
6921-
6922- LangAS ImplAS = LangAS::hlsl_private;
6923- Type = Context.getAddrSpaceQualType(Type, ImplAS);
6924- Decl->setType(Type);
6925- }
6926-
69276891void Sema::deduceOpenCLAddressSpace(ValueDecl *Decl) {
69286892 if (Decl->getType().hasAddressSpace())
69296893 return;
@@ -8011,10 +7975,8 @@ NamedDecl *Sema::ActOnVariableDeclarator(
80117975 // Handle attributes prior to checking for duplicates in MergeVarDecl
80127976 ProcessDeclAttributes(S, NewVD, D);
80137977
8014- if (getLangOpts().HLSL) {
7978+ if (getLangOpts().HLSL)
80157979 HLSL().ActOnVariableDeclarator(NewVD);
8016- deduceHLSLAddressSpace(NewVD);
8017- }
80187980
80197981 if (getLangOpts().OpenACC)
80207982 OpenACC().ActOnVariableDeclarator(NewVD);
@@ -13171,7 +13133,7 @@ bool Sema::DeduceVariableDeclarationType(VarDecl *VDecl, bool DirectInit,
1317113133 deduceOpenCLAddressSpace(VDecl);
1317213134
1317313135 if (getLangOpts().HLSL)
13174- deduceHLSLAddressSpace (VDecl);
13136+ HLSL().deduceAddressSpace (VDecl);
1317513137
1317613138 // If this is a redeclaration, check that the type we just deduced matches
1317713139 // the previously declared type.
0 commit comments