This revision was automatically updated to reflect the committed changes. Closed by commit rGadb290d97482: [Sema][SVE] Reject atomic sizeless types (authored by rsandifo-arm).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75734/new/ https://reviews.llvm.org/D75734 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Sema/SemaType.cpp clang/test/Sema/sizeless-1.c clang/test/SemaCXX/sizeless-1.cpp Index: clang/test/SemaCXX/sizeless-1.cpp =================================================================== --- clang/test/SemaCXX/sizeless-1.cpp +++ clang/test/SemaCXX/sizeless-1.cpp @@ -98,6 +98,7 @@ const volatile svint8_t const_volatile_int8 = local_int8; // expected-note {{declared const here}} const volatile svint8_t uninit_const_volatile_int8; // expected-error {{default initialization of an object of const type 'const volatile svint8_t'}} + _Atomic svint8_t atomic_int8; // expected-error {{_Atomic cannot be applied to sizeless type 'svint8_t'}} __restrict svint8_t restrict_int8; // expected-error {{requires a pointer or reference}} bool test_int8 = init_int8; // expected-error {{cannot initialize a variable of type 'bool' with an lvalue of type 'svint8_t'}} Index: clang/test/Sema/sizeless-1.c =================================================================== --- clang/test/Sema/sizeless-1.c +++ clang/test/Sema/sizeless-1.c @@ -84,6 +84,7 @@ const volatile svint8_t const_volatile_int8 = local_int8; // expected-note {{declared const here}} const volatile svint8_t uninit_const_volatile_int8; + _Atomic svint8_t atomic_int8; // expected-error {{_Atomic cannot be applied to sizeless type 'svint8_t'}} __restrict svint8_t restrict_int8; // expected-error {{requires a pointer or reference}} _Bool test_int8 = init_int8; // expected-error {{initializing '_Bool' with an expression of incompatible type 'svint8_t'}} Index: clang/lib/Sema/SemaType.cpp =================================================================== --- clang/lib/Sema/SemaType.cpp +++ clang/lib/Sema/SemaType.cpp @@ -8564,9 +8564,11 @@ DisallowedKind = 4; else if (T.hasQualifiers()) DisallowedKind = 5; + else if (T->isSizelessType()) + DisallowedKind = 6; else if (!T.isTriviallyCopyableType(Context)) // Some other non-trivially-copyable type (probably a C++ class) - DisallowedKind = 6; + DisallowedKind = 7; if (DisallowedKind != -1) { Diag(Loc, diag::err_atomic_specifier_bad_type) << DisallowedKind << T; Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -5925,7 +5925,7 @@ "incomplete result type %0 in function definition">; def err_atomic_specifier_bad_type : Error< "_Atomic cannot be applied to " - "%select{incomplete |array |function |reference |atomic |qualified |}0type " + "%select{incomplete |array |function |reference |atomic |qualified |sizeless |}0type " "%1 %select{||||||which is not trivially copyable}0">; // Expressions.
Index: clang/test/SemaCXX/sizeless-1.cpp =================================================================== --- clang/test/SemaCXX/sizeless-1.cpp +++ clang/test/SemaCXX/sizeless-1.cpp @@ -98,6 +98,7 @@ const volatile svint8_t const_volatile_int8 = local_int8; // expected-note {{declared const here}} const volatile svint8_t uninit_const_volatile_int8; // expected-error {{default initialization of an object of const type 'const volatile svint8_t'}} + _Atomic svint8_t atomic_int8; // expected-error {{_Atomic cannot be applied to sizeless type 'svint8_t'}} __restrict svint8_t restrict_int8; // expected-error {{requires a pointer or reference}} bool test_int8 = init_int8; // expected-error {{cannot initialize a variable of type 'bool' with an lvalue of type 'svint8_t'}} Index: clang/test/Sema/sizeless-1.c =================================================================== --- clang/test/Sema/sizeless-1.c +++ clang/test/Sema/sizeless-1.c @@ -84,6 +84,7 @@ const volatile svint8_t const_volatile_int8 = local_int8; // expected-note {{declared const here}} const volatile svint8_t uninit_const_volatile_int8; + _Atomic svint8_t atomic_int8; // expected-error {{_Atomic cannot be applied to sizeless type 'svint8_t'}} __restrict svint8_t restrict_int8; // expected-error {{requires a pointer or reference}} _Bool test_int8 = init_int8; // expected-error {{initializing '_Bool' with an expression of incompatible type 'svint8_t'}} Index: clang/lib/Sema/SemaType.cpp =================================================================== --- clang/lib/Sema/SemaType.cpp +++ clang/lib/Sema/SemaType.cpp @@ -8564,9 +8564,11 @@ DisallowedKind = 4; else if (T.hasQualifiers()) DisallowedKind = 5; + else if (T->isSizelessType()) + DisallowedKind = 6; else if (!T.isTriviallyCopyableType(Context)) // Some other non-trivially-copyable type (probably a C++ class) - DisallowedKind = 6; + DisallowedKind = 7; if (DisallowedKind != -1) { Diag(Loc, diag::err_atomic_specifier_bad_type) << DisallowedKind << T; Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -5925,7 +5925,7 @@ "incomplete result type %0 in function definition">; def err_atomic_specifier_bad_type : Error< "_Atomic cannot be applied to " - "%select{incomplete |array |function |reference |atomic |qualified |}0type " + "%select{incomplete |array |function |reference |atomic |qualified |sizeless |}0type " "%1 %select{||||||which is not trivially copyable}0">; // Expressions.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits