[Clang] make SVE types known to device targets too (#99446)

For the purpose of preprocessing and declarations in header files,
ensure clang accepts SVE types for both device and host targets.

Co-authored-by: Sander De Smalen <sander.desmalen@arm.com>
This commit is contained in:
Emanuele Rocca 2024-07-19 09:25:38 +02:00 committed by GitHub
parent 5c93a94f5a
commit c248d05c68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View File

@ -1384,7 +1384,8 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
#include "clang/Basic/OpenCLExtensionTypes.def"
}
if (Target.hasAArch64SVETypes()) {
if (Target.hasAArch64SVETypes() ||
(AuxTarget && AuxTarget->hasAArch64SVETypes())) {
#define SVE_TYPE(Name, Id, SingletonId) \
InitBuiltinType(SingletonId, BuiltinType::Id);
#include "clang/Basic/AArch64SVEACLETypes.def"

View File

@ -469,7 +469,9 @@ void Sema::Initialize() {
#include "clang/Basic/OpenCLExtensionTypes.def"
}
if (Context.getTargetInfo().hasAArch64SVETypes()) {
if (Context.getTargetInfo().hasAArch64SVETypes() ||
(Context.getAuxTargetInfo() &&
Context.getAuxTargetInfo()->hasAArch64SVETypes())) {
#define SVE_TYPE(Name, Id, SingletonId) \
addImplicitTypedef(Name, Context.SingletonId);
#include "clang/Basic/AArch64SVEACLETypes.def"

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-pch -o %t %s
// RUN: %clang_cc1 -triple aarch64-linux-gnu -include-pch %t \
// RUN: -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple aarch64-linux-gnu \
// RUN: -x hip-cpp-output -emit-pch -o %t %s
// expected-no-diagnostics