[SPIR-V] Allow `using` and `using namespace` declarations (#6229)
Fixes #5938
This commit is contained in:
Родитель
2fae54abe6
Коммит
ad4dc46888
|
@ -1025,6 +1025,10 @@ void SpirvEmitter::doDecl(const Decl *decl) {
|
|||
doClassTemplateDecl(classTemplateDecl);
|
||||
} else if (isa<FunctionTemplateDecl>(decl)) {
|
||||
// nothing to do.
|
||||
} else if (isa<UsingDecl>(decl)) {
|
||||
// nothing to do.
|
||||
} else if (isa<UsingDirectiveDecl>(decl)) {
|
||||
// nothing to do.
|
||||
} else {
|
||||
emitError("decl type %0 unimplemented", decl->getLocation())
|
||||
<< decl->getDeclKindName();
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s
|
||||
|
||||
namespace n {
|
||||
using f = float;
|
||||
namespace n2 {
|
||||
f foo(f a) { return sin(a); }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
using namespace n;
|
||||
using f32 = n::f;
|
||||
|
||||
|
||||
using n2::foo;
|
||||
|
||||
// CHECK: %src_main = OpFunction %float
|
||||
// CHECK-NEXT: %a = OpFunctionParameter %_ptr_Function_float
|
||||
f32 main(f32 a:A) : SV_Target {
|
||||
|
||||
// CHECK: OpFunctionCall %float %n__n2__foo %param_var_a_0
|
||||
return foo(a);
|
||||
}
|
Загрузка…
Ссылка в новой задаче