File tree 3 files changed +28
-4
lines changed 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -1804,8 +1804,9 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
1804
1804
diag::err_feature_check_malformed);
1805
1805
if (!II)
1806
1806
return false ;
1807
- else if (II->getBuiltinID () != 0 ) {
1808
- switch (II->getBuiltinID ()) {
1807
+ auto BuiltinID = II->getBuiltinID ();
1808
+ if (BuiltinID != 0 ) {
1809
+ switch (BuiltinID) {
1809
1810
case Builtin::BI__builtin_cpu_is:
1810
1811
return getTargetInfo ().supportsCpuIs ();
1811
1812
case Builtin::BI__builtin_cpu_init:
@@ -1818,8 +1819,11 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
1818
1819
// usual allocation and deallocation functions. Required by libc++
1819
1820
return 201802 ;
1820
1821
default :
1822
+ // __has_builtin should return false for aux builtins.
1823
+ if (getBuiltinInfo ().isAuxBuiltinID (BuiltinID))
1824
+ return false ;
1821
1825
return Builtin::evaluateRequiredTargetFeatures (
1822
- getBuiltinInfo ().getRequiredFeatures (II-> getBuiltinID () ),
1826
+ getBuiltinInfo ().getRequiredFeatures (BuiltinID ),
1823
1827
getTargetInfo ().getTargetOpts ().FeatureMap );
1824
1828
}
1825
1829
return true ;
Original file line number Diff line number Diff line change 3
3
// RUN: %clang_cc1 %s -ffreestanding -fms-extensions -fms-compatibility \
4
4
// RUN: -fms-compatibility-version=19.00 -triple x86_64-pc-windows-msvc -emit-llvm -o -
5
5
// %clang_cc1 %s -ffreestanding -triple x86_64-w64-windows-gnu -fms-extensions -emit-llvm -o -
6
- // RUN: %clang_cc1 %s -ffreestanding -fopenmp -fopenmp-is-target-device -aux-triple x86_64-unknown-linux-gnu
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
7
9
8
10
typedef __SIZE_TYPE__ size_t ;
9
11
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -fopenmp -triple=spirv64 -fopenmp-is-target-device \
2
+ // RUN: -aux-triple x86_64-linux-unknown -E %s | FileCheck -implicit-check-not=BAD %s
3
+
4
+ // RUN: %clang_cc1 -fopenmp -triple=nvptx64 -fopenmp-is-target-device \
5
+ // RUN: -aux-triple x86_64-linux-unknown -E %s | FileCheck -implicit-check-not=BAD %s
6
+
7
+ // RUN: %clang_cc1 -fopenmp -triple=amdgcn-amd-amdhsa -fopenmp-is-target-device \
8
+ // RUN: -aux-triple x86_64-linux-unknown -E %s | FileCheck -implicit-check-not=BAD %s
9
+
10
+ // RUN: %clang_cc1 -fopenmp -triple=aarch64 -fopenmp-is-target-device \
11
+ // RUN: -aux-triple x86_64-linux-unknown -E %s | FileCheck -implicit-check-not=BAD %s
12
+
13
+ // CHECK: GOOD
14
+ #if __has_builtin(__builtin_ia32_pause)
15
+ BAD
16
+ #else
17
+ GOOD
18
+ #endif
You can’t perform that action at this time.
0 commit comments