diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/C/C2y/n3622.c | 25 | ||||
-rw-r--r-- | clang/test/C/C2y/n3623.c | 3 | ||||
-rw-r--r-- | clang/test/CIR/CodeGen/dynamic-cast.cpp | 75 | ||||
-rw-r--r-- | clang/test/CIR/CodeGen/try-catch.cpp | 32 | ||||
-rw-r--r-- | clang/test/DebugInfo/KeyInstructions/flag.cpp | 5 | ||||
-rw-r--r-- | clang/test/Driver/debug-options.c | 6 | ||||
-rw-r--r-- | clang/test/Driver/wasm-toolchain.c | 7 | ||||
-rw-r--r-- | clang/test/Driver/wasm-toolchain.cpp | 25 | ||||
-rw-r--r-- | clang/test/InstallAPI/project-header-only-args-visibility.test | 69 | ||||
-rw-r--r-- | clang/test/Sema/inline.c | 18 | ||||
-rw-r--r-- | clang/test/SemaOpenACC/combined-construct-reduction-clause.cpp | 8 | ||||
-rw-r--r-- | clang/test/SemaOpenACC/compute-construct-reduction-clause.c | 3 | ||||
-rw-r--r-- | clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp | 60 | ||||
-rw-r--r-- | clang/test/SemaOpenACC/loop-construct-reduction-clause.cpp | 8 | ||||
-rw-r--r-- | clang/test/SemaTemplate/concepts.cpp | 17 | ||||
-rw-r--r-- | clang/test/SemaTemplate/partial-spec-instantiate.cpp | 13 |
16 files changed, 340 insertions, 34 deletions
diff --git a/clang/test/C/C2y/n3622.c b/clang/test/C/C2y/n3622.c new file mode 100644 index 0000000..95b92e8 --- /dev/null +++ b/clang/test/C/C2y/n3622.c @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -verify=good -pedantic -Wall -std=c2y %s +// RUN: %clang_cc1 -verify=compat,expected -pedantic -Wall -Wpre-c2y-compat -std=c2y %s +// RUN: %clang_cc1 -verify=ped,expected -pedantic -Wall -std=c23 %s +// RUN: %clang_cc1 -verify=ped,expected -pedantic -Wall -std=c17 %s +// good-no-diagnostics + +/* WG14 N3622: Clang 22 + * Allow calling static inline within extern inline + * + * This verifies that a constraint from previous standards is no longer + * triggered in C2y mode. The constraint is with calling a static function + * or using a static variable from an inline function with external linkage. + */ + +static void static_func(void) {} // expected-note {{declared here}} +static int static_var; // expected-note {{declared here}} + +extern inline void test(void) { + static_func(); /* ped-warning {{using static function 'static_func' in an inline function with external linkage is a C2y extension}} + compat-warning {{using static function 'static_func' in an inline function with external linkage is incompatible with standards before C2y}} + */ + static_var = 12; /* ped-warning {{using static variable 'static_var' in an inline function with external linkage is a C2y extension}} + compat-warning {{using static variable 'static_var' in an inline function with external linkage is incompatible with standards before C2y}} + */ +} diff --git a/clang/test/C/C2y/n3623.c b/clang/test/C/C2y/n3623.c index a557eda..5e004c1 100644 --- a/clang/test/C/C2y/n3623.c +++ b/clang/test/C/C2y/n3623.c @@ -64,7 +64,10 @@ int wmain(int, wchar_t *[], wchar_t *[]) {} // Invalid signatures. #if defined(INVALID1) inline int main(int, char *[]); /* invalid-error {{'main' is not allowed to be declared inline}} */ +#if !__is_target_os(darwin) +// This test doesn't make sense on Darwin where four arguments are allowed. int main(int, char *[], char *[], float); /* invalid-error {{too many parameters (4) for 'main': must be 0, 2, or 3}} */ +#endif float main(int); /* invalid-error {{'main' must return 'int'}} */ _Noreturn int main(int, char *[]); /* invalid-warning {{'main' is not allowed to be declared _Noreturn}} invalid-note {{remove '_Noreturn'}} diff --git a/clang/test/CIR/CodeGen/dynamic-cast.cpp b/clang/test/CIR/CodeGen/dynamic-cast.cpp index e5244b2..b493840 100644 --- a/clang/test/CIR/CodeGen/dynamic-cast.cpp +++ b/clang/test/CIR/CodeGen/dynamic-cast.cpp @@ -1,5 +1,11 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -emit-cir -mmlir --mlir-print-ir-before=cir-lowering-prepare %s -o %t.cir 2> %t.before.log // RUN: FileCheck %s --input-file=%t.before.log -check-prefix=CIR-BEFORE +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -emit-cir -mmlir --mlir-print-ir-after=cir-lowering-prepare %s -o %t.cir 2> %t.after.log +// RUN: FileCheck %s --input-file=%t.after.log -check-prefix=CIR-AFTER +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -emit-llvm %s -o %t-cir.ll +// RUN: FileCheck %s --input-file=%t-cir.ll -check-prefix=LLVM +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -emit-llvm %s -o %t.ll +// RUN: FileCheck %s --input-file=%t.ll -check-prefix=OGCG struct Base { virtual ~Base(); @@ -19,6 +25,46 @@ Derived *ptr_cast(Base *b) { // CIR-BEFORE: %{{.+}} = cir.dyn_cast ptr %{{.+}} : !cir.ptr<!rec_Base> -> !cir.ptr<!rec_Derived> #dyn_cast_info__ZTI4Base__ZTI7Derived // CIR-BEFORE: } +// CIR-AFTER: cir.func dso_local @_Z8ptr_castP4Base +// CIR-AFTER: %[[SRC:.*]] = cir.load{{.*}} %{{.+}} : !cir.ptr<!cir.ptr<!rec_Base>>, !cir.ptr<!rec_Base> +// CIR-AFTER-NEXT: %[[SRC_IS_NOT_NULL:.*]] = cir.cast ptr_to_bool %[[SRC]] : !cir.ptr<!rec_Base> -> !cir.bool +// CIR-AFTER-NEXT: %{{.+}} = cir.ternary(%[[SRC_IS_NOT_NULL]], true { +// CIR-AFTER-NEXT: %[[SRC_VOID_PTR:.*]] = cir.cast bitcast %[[SRC]] : !cir.ptr<!rec_Base> -> !cir.ptr<!void> +// CIR-AFTER-NEXT: %[[BASE_RTTI:.*]] = cir.const #cir.global_view<@_ZTI4Base> : !cir.ptr<!u8i> +// CIR-AFTER-NEXT: %[[DERIVED_RTTI:.*]] = cir.const #cir.global_view<@_ZTI7Derived> : !cir.ptr<!u8i> +// CIR-AFTER-NEXT: %[[HINT:.*]] = cir.const #cir.int<0> : !s64i +// CIR-AFTER-NEXT: %[[RT_CALL_RET:.*]] = cir.call @__dynamic_cast(%[[SRC_VOID_PTR]], %[[BASE_RTTI]], %[[DERIVED_RTTI]], %[[HINT]]) : (!cir.ptr<!void>, !cir.ptr<!u8i>, !cir.ptr<!u8i>, !s64i) -> !cir.ptr<!void> +// CIR-AFTER-NEXT: %[[CASTED:.*]] = cir.cast bitcast %[[RT_CALL_RET]] : !cir.ptr<!void> -> !cir.ptr<!rec_Derived> +// CIR-AFTER-NEXT: cir.yield %[[CASTED]] : !cir.ptr<!rec_Derived> +// CIR-AFTER-NEXT: }, false { +// CIR-AFTER-NEXT: %[[NULL_PTR:.*]] = cir.const #cir.ptr<null> : !cir.ptr<!rec_Derived> +// CIR-AFTER-NEXT: cir.yield %[[NULL_PTR]] : !cir.ptr<!rec_Derived> +// CIR-AFTER-NEXT: }) : (!cir.bool) -> !cir.ptr<!rec_Derived> +// CIR-AFTER: } + +// LLVM: define {{.*}} @_Z8ptr_castP4Base +// LLVM: %[[IS_NOT_NULL:.*]] = icmp ne ptr %[[PTR:.*]], null +// LLVM: br i1 %[[IS_NOT_NULL]], label %[[NOT_NULL:.*]], label %[[NULL:.*]] +// LLVM: [[NOT_NULL]]: +// LLVM: %[[RESULT:.*]] = call ptr @__dynamic_cast(ptr %[[PTR]], ptr @_ZTI4Base, ptr @_ZTI7Derived, i64 0) +// LLVM: br label %[[DONE:.*]] +// LLVM: [[NULL]]: +// LLVM: br label %[[DONE]] +// LLVM: [[DONE]]: +// LLVM: %[[RET:.*]] = phi ptr [ null, %[[NULL]] ], [ %[[RESULT]], %[[NOT_NULL]] ] + +// OGCG: define {{.*}} @_Z8ptr_castP4Base +// OGCG: %[[IS_NULL:.*]] = icmp eq ptr %[[PTR:.*]], null +// OGCG: br i1 %[[IS_NULL]], label %[[NULL:.*]], label %[[NOT_NULL:.*]] +// OGCG: [[NOT_NULL]]: +// OGCG: %[[RESULT:.*]] = call ptr @__dynamic_cast(ptr %[[PTR]], ptr @_ZTI4Base, ptr @_ZTI7Derived, i64 0) +// OGCG: br label %[[DONE:.*]] +// OGCG: [[NULL]]: +// OGCG: br label %[[DONE]] +// OGCG: [[DONE]]: +// OGCG: %[[RET:.*]] = phi ptr [ %[[RESULT]], %[[NOT_NULL]] ], [ null, %[[NULL]] ] + + Derived &ref_cast(Base &b) { return dynamic_cast<Derived &>(b); } @@ -26,3 +72,32 @@ Derived &ref_cast(Base &b) { // CIR-BEFORE: cir.func dso_local @_Z8ref_castR4Base // CIR-BEFORE: %{{.+}} = cir.dyn_cast ref %{{.+}} : !cir.ptr<!rec_Base> -> !cir.ptr<!rec_Derived> #dyn_cast_info__ZTI4Base__ZTI7Derived // CIR-BEFORE: } + +// CIR-AFTER: cir.func dso_local @_Z8ref_castR4Base +// CIR-AFTER: %[[SRC_VOID_PTR:.*]] = cir.cast bitcast %{{.+}} : !cir.ptr<!rec_Base> -> !cir.ptr<!void> +// CIR-AFTER-NEXT: %[[SRC_RTTI:.*]] = cir.const #cir.global_view<@_ZTI4Base> : !cir.ptr<!u8i> +// CIR-AFTER-NEXT: %[[DEST_RTTI:.*]] = cir.const #cir.global_view<@_ZTI7Derived> : !cir.ptr<!u8i> +// CIR-AFTER-NEXT: %[[OFFSET_HINT:.*]] = cir.const #cir.int<0> : !s64i +// CIR-AFTER-NEXT: %[[CASTED_PTR:.*]] = cir.call @__dynamic_cast(%[[SRC_VOID_PTR]], %[[SRC_RTTI]], %[[DEST_RTTI]], %[[OFFSET_HINT]]) : (!cir.ptr<!void>, !cir.ptr<!u8i>, !cir.ptr<!u8i>, !s64i) -> !cir.ptr<!void> +// CIR-AFTER-NEXT: %[[NULL_PTR:.*]] = cir.const #cir.ptr<null> : !cir.ptr<!void> +// CIR-AFTER-NEXT: %[[CASTED_PTR_IS_NULL:.*]] = cir.cmp(eq, %[[CASTED_PTR]], %[[NULL_PTR]]) : !cir.ptr<!void>, !cir.bool +// CIR-AFTER-NEXT: cir.if %[[CASTED_PTR_IS_NULL]] { +// CIR-AFTER-NEXT: cir.call @__cxa_bad_cast() : () -> () +// CIR-AFTER-NEXT: cir.unreachable +// CIR-AFTER-NEXT: } +// CIR-AFTER-NEXT: %{{.+}} = cir.cast bitcast %[[CASTED_PTR]] : !cir.ptr<!void> -> !cir.ptr<!rec_Derived> +// CIR-AFTER: } + +// LLVM: define {{.*}} ptr @_Z8ref_castR4Base +// LLVM: %[[RESULT:.*]] = call ptr @__dynamic_cast(ptr %{{.*}}, ptr @_ZTI4Base, ptr @_ZTI7Derived, i64 0) +// LLVM: %[[IS_NULL:.*]] = icmp eq ptr %[[RESULT]], null +// LLVM: br i1 %[[IS_NULL]], label %[[BAD_CAST:.*]], label %[[DONE:.*]] +// LLVM: [[BAD_CAST]]: +// LLVM: call void @__cxa_bad_cast() + +// OGCG: define {{.*}} ptr @_Z8ref_castR4Base +// OGCG: %[[RESULT:.*]] = call ptr @__dynamic_cast(ptr %0, ptr @_ZTI4Base, ptr @_ZTI7Derived, i64 0) +// OGCG: %[[IS_NULL:.*]] = icmp eq ptr %[[RESULT]], null +// OGCG: br i1 %[[IS_NULL]], label %[[BAD_CAST:.*]], label %[[DONE:.*]] +// OGCG: [[BAD_CAST]]: +// OGCG: call void @__cxa_bad_cast() diff --git a/clang/test/CIR/CodeGen/try-catch.cpp b/clang/test/CIR/CodeGen/try-catch.cpp new file mode 100644 index 0000000..8f0b3c4 --- /dev/null +++ b/clang/test/CIR/CodeGen/try-catch.cpp @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -fclangir -emit-llvm %s -o %t-cir.ll +// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -emit-llvm %s -o %t.ll +// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG + +void empty_try_block_with_catch_all() { + try {} catch (...) {} +} + +// CIR: cir.func{{.*}} @_Z30empty_try_block_with_catch_allv() +// CIR: cir.return + +// LLVM: define{{.*}} void @_Z30empty_try_block_with_catch_allv() +// LLVM: ret void + +// OGCG: define{{.*}} void @_Z30empty_try_block_with_catch_allv() +// OGCG: ret void + +void empty_try_block_with_catch_with_int_exception() { + try {} catch (int e) {} +} + +// CIR: cir.func{{.*}} @_Z45empty_try_block_with_catch_with_int_exceptionv() +// CIR: cir.return + +// LLVM: define{{.*}} void @_Z45empty_try_block_with_catch_with_int_exceptionv() +// LLVM: ret void + +// OGCG: define{{.*}} void @_Z45empty_try_block_with_catch_with_int_exceptionv() +// OGCG: ret void diff --git a/clang/test/DebugInfo/KeyInstructions/flag.cpp b/clang/test/DebugInfo/KeyInstructions/flag.cpp index a5cd855..6aeeed6 100644 --- a/clang/test/DebugInfo/KeyInstructions/flag.cpp +++ b/clang/test/DebugInfo/KeyInstructions/flag.cpp @@ -1,12 +1,15 @@ // RUN: %clang -### -target x86_64 -c -gdwarf -gkey-instructions %s 2>&1 | FileCheck %s --check-prefixes=KEY-INSTRUCTIONS // RUN: %clang -### -target x86_64 -c -gdwarf -gno-key-instructions %s 2>&1 | FileCheck %s --check-prefixes=NO-KEY-INSTRUCTIONS +// RUN: %clang -### -target x86_64 -c -gno-key-instructions %s 2>&1 | FileCheck %s --check-prefixes=NO-DEBUG //// Help. // RUN %clang --help | FileCheck %s --check-prefix=HELP -// HELP: -gkey-instructions Enable Key Instructions, which reduces the jumpiness of debug stepping in optimized C/C++ code in some debuggers. DWARF only. Implies -g. +// HELP: -gkey-instructions Enable Key Instructions, which reduces the jumpiness of debug stepping in optimized C/C++ code in some debuggers. DWARF only. // KEY-INSTRUCTIONS: "-gkey-instructions" // NO-KEY-INSTRUCTIONS-NOT: key-instructions +// NO-DEBUG-NOT: debug-info-kind +// NO-DEBUG-NOT: dwarf //// Help hidden: flag should not be visible. // RUN: %clang --help | FileCheck %s --check-prefix=HELP diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c index 73f2f40..45ac450 100644 --- a/clang/test/Driver/debug-options.c +++ b/clang/test/Driver/debug-options.c @@ -268,11 +268,11 @@ // RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s // RUN: %clang -### -c -fdebug-ranges-base-address -fno-debug-ranges-base-address %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s // -// RUN: %clang -### -c -gomit-unreferenced-methods -fno-standalone-debug %s 2>&1 | FileCheck -check-prefix=INCTYPES %s +// RUN: %clang -### -c -g -gomit-unreferenced-methods -fno-standalone-debug %s 2>&1 | FileCheck -check-prefix=INCTYPES %s // RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=NOINCTYPES %s -// RUN: %clang -### -c -gomit-unreferenced-methods -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 \ +// RUN: %clang -### -c -g -gomit-unreferenced-methods -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 \ // RUN: | FileCheck -check-prefix=NOINCTYPES %s -// RUN: %clang -### -c -gomit-unreferenced-methods -fstandalone-debug %s 2>&1 | FileCheck -check-prefix=NOINCTYPES %s +// RUN: %clang -### -c -g -gomit-unreferenced-methods -fstandalone-debug %s 2>&1 | FileCheck -check-prefix=NOINCTYPES %s // // RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s diff --git a/clang/test/Driver/wasm-toolchain.c b/clang/test/Driver/wasm-toolchain.c index 91803fe..29a94ae 100644 --- a/clang/test/Driver/wasm-toolchain.c +++ b/clang/test/Driver/wasm-toolchain.c @@ -296,3 +296,10 @@ // RUN: | FileCheck -check-prefix=LINK_WASIP2_USE_WASMLD %s // LINK_WASIP2_USE_WASMLD: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" // LINK_WASIP2_USE_WASMLD: wasm-ld{{.*}}" "-m" "wasm32" {{.*}} "[[temp]]" {{.*}} + +// Basic `wasm32-linux-muslwali` compile-link test. + +// RUN: %clang -### --target=wasm32-linux-muslwali --sysroot=/foo %s 2>&1 \ +// RUN: | FileCheck -check-prefix=LINK_WALI_BASIC %s +// LINK_WALI_BASIC: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" +// LINK_WALI_BASIC: wasm-ld{{.*}}" "-L/foo/lib/wasm32-linux-muslwali" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" diff --git a/clang/test/Driver/wasm-toolchain.cpp b/clang/test/Driver/wasm-toolchain.cpp index ba1c55b..d7ff76c 100644 --- a/clang/test/Driver/wasm-toolchain.cpp +++ b/clang/test/Driver/wasm-toolchain.cpp @@ -86,3 +86,28 @@ // COMPILE_STDCXX: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include" // COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/wasm32-wasi" // COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include" + +// RUN: %clangxx -### --target=wasm32-linux-muslwali --stdlib=libc++ %s 2>&1 \ +// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree/usr \ +// RUN: | FileCheck -check-prefix=COMPILE_WALI %s +// COMPILE_WALI: "-cc1" +// COMPILE_WALI: "-resource-dir" "[[RESOURCE_DIR:[^"]*]]" +// COMPILE_WALI: "-isysroot" "[[SYSROOT:[^"]+]]" +// COMPILE_WALI: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/wasm32-linux-muslwali/c++/v1" +// COMPILE_WALI: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/v1" +// COMPILE_WALI: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include" +// COMPILE_WALI: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/wasm32-linux-muslwali" +// COMPILE_WALI: "-internal-isystem" "[[SYSROOT:[^"]+]]/include" + +// RUN: %clangxx -### --target=wasm32-linux-muslwali --stdlib=libstdc++ %s 2>&1 \ +// RUN: --sysroot=%S/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr \ +// RUN: | FileCheck -check-prefix=COMPILE_WALI_STDCXX %s +// COMPILE_WALI_STDCXX: "-cc1" +// COMPILE_WALI_STDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]*]]" +// COMPILE_WALI_STDCXX: "-isysroot" "[[SYSROOT:[^"]+]]" +// COMPILE_WALI_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/4.8/wasm32-linux-muslwali" +// COMPILE_WALI_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/4.8" +// COMPILE_WALI_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/4.8/backward" +// COMPILE_WALI_STDCXX: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include" +// COMPILE_WALI_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/wasm32-linux-muslwali" +// COMPILE_WALI_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include" diff --git a/clang/test/InstallAPI/project-header-only-args-visibility.test b/clang/test/InstallAPI/project-header-only-args-visibility.test new file mode 100644 index 0000000..0403487 --- /dev/null +++ b/clang/test/InstallAPI/project-header-only-args-visibility.test @@ -0,0 +1,69 @@ +; RUN: rm -rf %t +; RUN: split-file %s %t +; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json + +; RUN: clang-installapi \ +; RUN: -target arm64-apple-macos26 -install_name @rpath/libfoo.dylib \ +; RUN: -current_version 1 -compatibility_version 1 \ +; RUN: -Xproject -fvisibility=hidden -I%t/usr/include \ +; RUN: -I%t -dynamiclib %t/inputs.json \ +; RUN: -o %t/output.tbd 2>&1 | FileCheck %s --allow-empty +; RUN: llvm-readtapi --compare %t/output.tbd %t/expected.tbd 2>&1 | FileCheck %s --allow-empty + +; CHECK-NOT: error +; CHECK-NOT: warning + +//--- usr/include/public.h +int foo(void); + +//--- project.h +int bar(void); + +//--- expected.tbd +{ + "main_library": { + "exported_symbols": [ + { + "text": { + "global": [ + "_foo" + ] + } + } + ], + "flags": [ + { + "attributes": [ + "not_app_extension_safe" + ] + } + ], + "install_names": [ + { + "name": "@rpath/libfoo.dylib" + } + ], + "target_info": [ + { + "min_deployment": "26", + "target": "arm64-macos" + } + ] + }, + "tapi_tbd_version": 5 +} + +;--- inputs.json.in +{ + "headers": [ + { + "path" : "DSTROOT/usr/include/public.h", + "type" : "public" + }, + { + "path" : "DSTROOT/project.h", + "type" : "project" + } + ], + "version": "3" +} diff --git a/clang/test/Sema/inline.c b/clang/test/Sema/inline.c index 804c510..6361db8 100644 --- a/clang/test/Sema/inline.c +++ b/clang/test/Sema/inline.c @@ -11,14 +11,14 @@ static int staticFunction(void); // expected-note + {{'staticFunction' declared static struct { int x; } staticStruct; // expected-note + {{'staticStruct' declared here}} inline int useStatic (void) { // expected-note 3 {{use 'static' to give inline function 'useStatic' internal linkage}} - staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}} - (void)staticStruct.x; // expected-warning{{static variable 'staticStruct' is used in an inline function with external linkage}} - return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}} + staticFunction(); // expected-warning{{using static function 'staticFunction' in an inline function with external linkage is a C2y extension}} + (void)staticStruct.x; // expected-warning{{using static variable 'staticStruct' in an inline function with external linkage is a C2y extension}} + return staticVar; // expected-warning{{using static variable 'staticVar' in an inline function with external linkage is a C2y extension}} } extern inline int useStaticFromExtern (void) { // no suggestions - staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}} - return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}} + staticFunction(); // expected-warning{{using static function 'staticFunction' in an inline function with external linkage is a C2y extension}} + return staticVar; // expected-warning{{using static variable 'staticVar' in an inline function with external linkage is a C2y extension}} } static inline int useStaticFromStatic (void) { @@ -67,8 +67,8 @@ inline int useStaticMainFile (void) { #pragma clang diagnostic warning "-Wstatic-in-inline" inline int useStaticAgain (void) { // expected-note 2 {{use 'static' to give inline function 'useStaticAgain' internal linkage}} - staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}} - return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}} + staticFunction(); // expected-warning{{using static function 'staticFunction' in an inline function with external linkage is a C2y extension}} + return staticVar; // expected-warning{{using static variable 'staticVar' in an inline function with external linkage is a C2y extension}} } #pragma clang diagnostic pop @@ -86,8 +86,8 @@ extern inline void defineStaticVarInExtern(void) { // Check behavior of line markers. # 1 "XXX.h" 1 inline int useStaticMainFileInLineMarker(void) { // expected-note 2 {{use 'static' to give inline function 'useStaticMainFileInLineMarker' internal linkage}} - staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}} - return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}} + staticFunction(); // expected-warning{{using static function 'staticFunction' in an inline function with external linkage is a C2y extension}} + return staticVar; // expected-warning{{using static variable 'staticVar' in an inline function with external linkage is a C2y extension}} } # 100 "inline.c" 2 diff --git a/clang/test/SemaOpenACC/combined-construct-reduction-clause.cpp b/clang/test/SemaOpenACC/combined-construct-reduction-clause.cpp index 5aa90bd..72d7e6b 100644 --- a/clang/test/SemaOpenACC/combined-construct-reduction-clause.cpp +++ b/clang/test/SemaOpenACC/combined-construct-reduction-clause.cpp @@ -166,19 +166,17 @@ void uses(unsigned Parm) { CompositeHasComposite CoCArr[5]; // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of array type 'CompositeHasComposite'}} + // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel loop reduction(+:CoCArr) for(int i = 0; i < 5; ++i); - // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}} + // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel loop reduction(+:CoCArr[3]) for(int i = 0; i < 5; ++i); - // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of sub-array type 'CompositeHasComposite'}} + // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel loop reduction(+:CoCArr[1:1]) diff --git a/clang/test/SemaOpenACC/compute-construct-reduction-clause.c b/clang/test/SemaOpenACC/compute-construct-reduction-clause.c index 07cb498..265c498 100644 --- a/clang/test/SemaOpenACC/compute-construct-reduction-clause.c +++ b/clang/test/SemaOpenACC/compute-construct-reduction-clause.c @@ -72,8 +72,7 @@ void uses(unsigned Parm) { while (1); struct CompositeHasComposite ChCArray[5]; - // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of sub-array type 'struct CompositeHasComposite'}} + // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel reduction(&: CoS, Array[I], ChCArray[0:I]) diff --git a/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp b/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp index 9c2f3d9..edc67ce 100644 --- a/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp +++ b/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp @@ -91,19 +91,17 @@ void uses(unsigned Parm) { CompositeHasComposite CoCArr[5]; // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of array type 'CompositeHasComposite'}} + // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel reduction(+:CoCArr) while (1); - // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}} + // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel reduction(+:CoCArr[3]) while (1); - // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of sub-array type 'CompositeHasComposite'}} + // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel reduction(+:CoCArr[1:1]) @@ -121,7 +119,7 @@ void uses(unsigned Parm) { int *IPtrArr[5]; // expected-error@+3{{invalid type 'int *' used in OpenACC 'reduction' variable reference; type is not a scalar value, or array of scalars, or composite of scalars}} - // expected-note@+2{{used as element type of array type 'int *'}} + // expected-note@+2{{used as element type of array type 'int *[5]'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel reduction(+:IPtrArr) while (1); @@ -136,7 +134,7 @@ void uses(unsigned Parm) { HasPtr HPArr[5]; // expected-error@+4{{invalid type 'int *' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of array type 'HasPtr'}} + // expected-note@+3{{used as element type of array type 'HasPtr[5]'}} // expected-note@#HASPTR{{used as field 'I' of composite 'HasPtr'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel reduction(+:HPArr) @@ -152,7 +150,7 @@ void uses(unsigned Parm) { #pragma acc parallel reduction(+:CplxI) while (1); // expected-error@+3{{invalid type '_Complex int' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+2{{used as element type of array type '_Complex int'}} + // expected-note@+2{{used as element type of array type '_Complex int[5]'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel reduction(+:CplxIArr) while (1); @@ -161,7 +159,7 @@ void uses(unsigned Parm) { #pragma acc parallel reduction(+:CplxF) while (1); // expected-error@+3{{invalid type '_Complex float' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+2{{used as element type of array type '_Complex float'}} + // expected-note@+2{{used as element type of array type '_Complex float[5]'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc parallel reduction(+:CplxFArr) while (1); @@ -242,6 +240,50 @@ void TemplUses(T Parm, U CoS, V ChC) { // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, or composite variable member}} #pragma acc parallel reduction(&: ChCPtr->COS) while (1); + + T ThreeDArray[3][4][5]; + + // expected-error@+3{{invalid type 'int[4][5]' used in OpenACC 'reduction' variable reference; type is not a scalar value}} + // expected-note@+2{{used as element type of array type 'int[3][4][5]'}} + // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} +#pragma acc parallel reduction(+:ThreeDArray) + while (1); + // expected-error@+3{{invalid type 'int[5]' used in OpenACC 'reduction' variable reference; type is not a scalar value}} + // expected-note@+2{{used as element type of array type 'int[4][5]'}} + // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} +#pragma acc parallel reduction(+:ThreeDArray[1:1]) + while (1); + // expected-error@+3{{invalid type 'int[5]' used in OpenACC 'reduction' variable reference; type is not a scalar value}} + // expected-note@+2{{used as element type of array type 'int[4][5]'}} + // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} +#pragma acc parallel reduction(+:ThreeDArray[1]) + while (1); + +#pragma acc parallel reduction(+:ThreeDArray[1:1][1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1:1][1:1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1:1]) + while (1); + +#pragma acc parallel reduction(+:ThreeDArray[1:1][1][1:1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1:1][1][1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1:1][1:1][1:1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1:1][1:1][1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1][1:1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1][1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1:1][1:1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1:1][1]) + while (1); } void inst() { diff --git a/clang/test/SemaOpenACC/loop-construct-reduction-clause.cpp b/clang/test/SemaOpenACC/loop-construct-reduction-clause.cpp index 2a07c2c..f2dd928 100644 --- a/clang/test/SemaOpenACC/loop-construct-reduction-clause.cpp +++ b/clang/test/SemaOpenACC/loop-construct-reduction-clause.cpp @@ -153,19 +153,17 @@ void uses() { CompositeHasComposite CoCArr[5]; // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of array type 'CompositeHasComposite'}} + // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc loop reduction(+:CoCArr) for(int i = 0; i < 5; ++i); - // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}} + // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc loop reduction(+:CoCArr[3]) for(int i = 0; i < 5; ++i); - // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of sub-array type 'CompositeHasComposite'}} + // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}} #pragma acc loop reduction(+:CoCArr[1:1]) diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp index 768af09..1dbb989 100644 --- a/clang/test/SemaTemplate/concepts.cpp +++ b/clang/test/SemaTemplate/concepts.cpp @@ -1476,3 +1476,20 @@ static_assert( requires {{ &f } -> C;} ); // expected-error {{reference to overl // expected-error@-1 {{static assertion failed due to requirement 'requires { { &f() } -> C; }'}} } + +namespace GH162770 { + enum e {}; + template<e> struct s {}; + + template<typename> struct specialized; + template<e x> struct specialized<s<x>> { + static auto make(auto) -> s<x>; + }; + + template<e x> struct check { + static constexpr auto m = requires { specialized<s<x>>::make(0); }; + }; + + template<typename... Ts> auto comma = (..., Ts()); + auto b = comma<check<e{}>>; +} // namespace GH162770 diff --git a/clang/test/SemaTemplate/partial-spec-instantiate.cpp b/clang/test/SemaTemplate/partial-spec-instantiate.cpp index 0b84df6..44b5800 100644 --- a/clang/test/SemaTemplate/partial-spec-instantiate.cpp +++ b/clang/test/SemaTemplate/partial-spec-instantiate.cpp @@ -152,3 +152,16 @@ namespace GH60778 { ClassTemplate<>::Nested<int> instantiation; } } +#if __cplusplus >= 201103L +namespace GH162855 { + template <class...> using A = int; + template <class, int> struct B; + template <class...> struct C; + template <template <class, int...> class TT, long... X> + struct C<TT<int, X...>> { + template <class... Y> using l = A<B<Y, X>...>; + }; + template <class> struct D; + template struct C<D<int>>; +} // namespace GH162855 +#endif |