Skip to content

Commit c310b4e

Browse files
authored
Revert "[Clang] __has_builtin should return false for aux triple builtins (#121839) (#124626)
This reverts commit 1c28b92. Breaks CUDA on ARM, see [here](#121839 (comment)).
1 parent 5d1c596 commit c310b4e

File tree

3 files changed

+4
-28
lines changed

3 files changed

+4
-28
lines changed

clang/lib/Lex/PPMacroExpansion.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,9 +1804,8 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
18041804
diag::err_feature_check_malformed);
18051805
if (!II)
18061806
return false;
1807-
auto BuiltinID = II->getBuiltinID();
1808-
if (BuiltinID != 0) {
1809-
switch (BuiltinID) {
1807+
else if (II->getBuiltinID() != 0) {
1808+
switch (II->getBuiltinID()) {
18101809
case Builtin::BI__builtin_cpu_is:
18111810
return getTargetInfo().supportsCpuIs();
18121811
case Builtin::BI__builtin_cpu_init:
@@ -1819,11 +1818,8 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
18191818
// usual allocation and deallocation functions. Required by libc++
18201819
return 201802;
18211820
default:
1822-
// __has_builtin should return false for aux builtins.
1823-
if (getBuiltinInfo().isAuxBuiltinID(BuiltinID))
1824-
return false;
18251821
return Builtin::evaluateRequiredTargetFeatures(
1826-
getBuiltinInfo().getRequiredFeatures(BuiltinID),
1822+
getBuiltinInfo().getRequiredFeatures(II->getBuiltinID()),
18271823
getTargetInfo().getTargetOpts().FeatureMap);
18281824
}
18291825
return true;

clang/test/Headers/__cpuidex_conflict.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
// RUN: %clang_cc1 %s -ffreestanding -fms-extensions -fms-compatibility \
44
// RUN: -fms-compatibility-version=19.00 -triple x86_64-pc-windows-msvc -emit-llvm -o -
55
// %clang_cc1 %s -ffreestanding -triple x86_64-w64-windows-gnu -fms-extensions -emit-llvm -o -
6-
//
7-
// FIXME: See https://github.com/llvm/llvm-project/pull/121839
8-
// RUN: not %clang_cc1 %s -ffreestanding -fopenmp -fopenmp-is-target-device -aux-triple x86_64-unknown-linux-gnu
6+
// RUN: %clang_cc1 %s -ffreestanding -fopenmp -fopenmp-is-target-device -aux-triple x86_64-unknown-linux-gnu
97

108
typedef __SIZE_TYPE__ size_t;
119

clang/test/Preprocessor/builtin_aux_info.cpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)