brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · 37dee9d Raw
51 lines · cpp
1// Check that we emit warnings/errors for different combinations of2// exceptions, rtti, and vptr sanitizer flags for generic (unknown) x86 linux,3// and for PS4 when its behaviour differs from the generic x86-linux.4// No warnings/errors should be emitted for unknown, except if combining5// the vptr sanitizer with -fno-rtti6 7// Special cases: -fcxx-exceptions in C code should warn about unused arguments8// We should also not have any rtti-related arguments9// RUN: %clang -x c -### -target x86_64-unknown-unknown -c -fcxx-exceptions %s 2>&1 | FileCheck -check-prefix=CHECK-UNUSED -check-prefix=CHECK-RTTI %s10 11// Make sure we keep the last -frtti/-fno-rtti argument12// RUN: %clang -### -c -fno-rtti -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-RTTI %s13// RUN: %clang -### -c -frtti -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RTTI %s14 15// -fsanitize=vptr16// Make sure we only error/warn once, when trying to enable vptr and17// undefined and have -fno-rtti18// RUN: not %clang -### -c --target=x86_64-unknown-linux -fsanitize=undefined -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR -check-prefix=CHECK-OK %s19// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s20// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s21// RUN: not %clang -### -c --target=x86_64-unknown-linux -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s22// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s23// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s24// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-WARN %s25// RUN: %clang -### -c -target x86_64-sie-ps5 -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-WARN %s26 27// Exceptions + no/default rtti28// RUN: %clang -### -c -target x86_64-unknown-unknown -fcxx-exceptions -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s29// RUN: %clang -### -c -target x86_64-unknown-unknown -fcxx-exceptions %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s30// In C++, -fexceptions implies -fcxx-exceptions31// RUN: %clang -x c++ -### -c -target x86_64-unknown-unknown -fexceptions -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s32// RUN: %clang -x c++ -### -c -target x86_64-unknown-unknown -fexceptions %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s33 34// -frtti + exceptions35// RUN: %clang -### -c -target x86_64-unknown-unknown -fcxx-exceptions -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s36 37// -f{no-,}rtti/default38// RUN: %clang -### -c -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RTTI %s39// RUN: %clang -### -c -target x86_64-sie-ps5 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RTTI %s40// RUN: %clang -### -c -target x86_64-unknown-unknown -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-RTTI %s41// RUN: %clang -### -c -target x86_64-unknown-unknown -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RTTI %s42// RUN: %clang -### -c -target x86_64-unknown-unknown %s 2>&1 | FileCheck -check-prefix=CHECK-RTTI %s43 44// CHECK-UNUSED: warning: argument unused during compilation: '-fcxx-exceptions'45// CHECK-SAN-WARN: implicitly disabling vptr sanitizer because rtti wasn't enabled46// CHECK-SAN-ERROR: invalid argument '-fsanitize=vptr' not allowed with '-fno-rtti'47// CHECK-RTTI-NOT: "-fno-rtti"48// CHECK-NO-RTTI: "-fno-rtti"49 50// CHECK-OK-NOT: {{warning:|error:}}51