mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 12:36:37 +00:00

HLSL doesn't have a runtime loader model that supports global construction by a loader or runtime initializer. To allow us to leverage global constructors with minimal code generation impact we put calls to the global constructors inside the generated entry function. Differential Revision: https://reviews.llvm.org/D132977
19 lines
397 B
HLSL
19 lines
397 B
HLSL
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fsyntax-only %s -verify
|
|
|
|
int i;
|
|
|
|
struct Pup {
|
|
Pup() {
|
|
i++;
|
|
}
|
|
};
|
|
|
|
// expected-error@+1 {{initializer priorities are not supported in HLSL}}
|
|
Pup __attribute__((init_priority(1))) Fido;
|
|
|
|
// expected-error@+1 {{initializer priorities are not supported in HLSL}}
|
|
__attribute__((constructor(1))) void call_me_first(void) {
|
|
i = 12;
|
|
}
|
|
|