Skip to content

Commit ff8b4f8

Browse files
authored
[AMDGCNSPIRV][NFC] Match AMDGPU's __builtin_va_list type (#152044)
AMDGCN flavoured SPIRV should math AMDGPU TI as much as possible, and the va_list difference was spurious.
1 parent 06458ff commit ff8b4f8

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

clang/lib/Basic/Targets/SPIR.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ class LLVM_LIBRARY_VISIBILITY SPIRV64AMDGCNTargetInfo final
438438

439439
ArrayRef<const char *> getGCCRegNames() const override;
440440

441+
BuiltinVaListKind getBuiltinVaListKind() const override {
442+
return TargetInfo::CharPtrBuiltinVaList;
443+
}
444+
441445
bool initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
442446
StringRef,
443447
const std::vector<std::string> &) const override;

clang/test/Sema/amdgcn-va-list-type.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %clang_cc1 %s -triple amdgcn-amd-amdhsa -fsyntax-only -verify
2+
// RUN: %clang_cc1 %s -triple spirv64-amd-amdhsa -fsyntax-only -verify
3+
4+
// expected-no-diagnostics
5+
6+
typedef char* va_list;
7+
8+
void foo(const char* f, ...) {
9+
int r;
10+
va_list args;
11+
__builtin_va_start(args, f);
12+
__builtin_va_end(args);
13+
}

0 commit comments

Comments
 (0)