Skip to content

Commit acba5c7

Browse files
committed
[ser] Implement INTRIN_FLAG_STATIC_MEMBER
1 parent 5cd5ef8 commit acba5c7

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

tools/clang/lib/Sema/SemaHLSL.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,10 @@ static const char *g_DeprecatedEffectObjectNames[] = {
18521852
"RenderTargetView", // 16
18531853
};
18541854

1855+
static bool IsStaticMember(const HLSL_INTRINSIC *fn) {
1856+
return fn->Flags & INTRIN_FLAG_STATIC_MEMBER;
1857+
}
1858+
18551859
static bool IsVariadicIntrinsicFunction(const HLSL_INTRINSIC *fn) {
18561860
return fn->pArgs[fn->uNumArgs - 1].uTemplateId == INTRIN_TEMPLATE_VARARGS;
18571861
}
@@ -1992,7 +1996,7 @@ AddHLSLIntrinsicFunction(ASTContext &context, NamespaceDecl *NS,
19921996
std::vector<QualType> fnArgTypes(functionArgQualTypes.begin() + 1,
19931997
functionArgQualTypes.end());
19941998

1995-
StorageClass SC = pIntrinsic->bStaticMember ? SC_Static : SC_Extern;
1999+
StorageClass SC = IsStaticMember(pIntrinsic) ? SC_Static : SC_Extern;
19962000
QualType functionType =
19972001
context.getFunctionType(fnReturnType, fnArgTypes, protoInfo, paramMods);
19982002
FunctionDecl *functionDecl = FunctionDecl::Create(
@@ -3194,7 +3198,7 @@ class HLSLExternalSource : public ExternalSemaSource {
31943198
&m_context->Idents.get(StringRef(intrinsic->pArgs[0].pName));
31953199
DeclarationName declarationName = DeclarationName(ii);
31963200

3197-
StorageClass SC = intrinsic->bStaticMember ? SC_Static : SC_None;
3201+
StorageClass SC = IsStaticMember(intrinsic) ? SC_Static : SC_None;
31983202

31993203
CXXMethodDecl *functionDecl = CreateObjectFunctionDeclarationWithParams(
32003204
*m_context, recordDecl, functionResultQT,
@@ -3595,7 +3599,7 @@ class HLSLExternalSource : public ExternalSemaSource {
35953599
InitParamMods(intrinsic, paramMods);
35963600

35973601
// Create FunctionDecl.
3598-
StorageClass SC = intrinsic->bStaticMember ? SC_Static : SC_Extern;
3602+
StorageClass SC = IsStaticMember(intrinsic) ? SC_Static : SC_Extern;
35993603
QualType fnType = getIntrinsicFunctionType(paramTypes, paramMods);
36003604
TypeSourceInfo *TInfo =
36013605
m_sema->getASTContext().CreateTypeSourceInfo(fnType, 0);
@@ -5958,7 +5962,7 @@ class HLSLExternalSource : public ExternalSemaSource {
59585962
Params.push_back(paramDecl);
59595963
}
59605964

5961-
StorageClass SC = intrinsic->bStaticMember ? SC_Static : SC_Extern;
5965+
StorageClass SC = IsStaticMember(intrinsic) ? SC_Static : SC_Extern;
59625966
QualType T = TInfo->getType();
59635967
DeclarationNameInfo NameInfo(FunctionTemplate->getDeclName(), NoLoc);
59645968
CXXMethodDecl *method = CXXMethodDecl::Create(

utils/hct/hctdb_instrhelp.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -999,10 +999,9 @@ def get_hlsl_intrinsics():
999999
flags = " | ".join(flags)
10001000
else:
10011001
flags = "0"
1002-
ns_table += " {(UINT)%s::%s_%s, %s, 0x%x, %d, %d, g_%s_Args%s},\n" % (
1002+
ns_table += " {(UINT)%s::%s, %s, 0x%x, %d, %d, g_%s_Args%s},\n" % (
10031003
opcode_namespace,
1004-
id_prefix,
1005-
i.name,
1004+
i.enum_name,
10061005
flags,
10071006
i.min_shader_model,
10081007
i.overload_param_index,

0 commit comments

Comments
 (0)