brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.9 KiB · e1a07d2 Raw
180 lines · cpp
1// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=undefined %s -o - | FileCheck --check-prefix=CHECK-UBSAN %s2// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=alignment %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-ALIGNMENT %s3// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=bool %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-BOOL %s4// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=builtin %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-BUILTIN %s5// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=array-bounds %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-ARRAY-BOUNDS %s6// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=enum %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-ENUM %s7// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=float-cast-overflow %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-FLOAT-CAST-OVERFLOW %s8// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=integer-divide-by-zero %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-INTEGER-DIVIDE-BY-ZERO %s9// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=nonnull-attribute %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-NONNULL-ATTRIBUTE %s10// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=null %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-NULL %s11// object-size is a no-op at O0.12// RUN: %clang -E -target x86_64-unknown-linux-gnu -O2 -fsanitize=object-size %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-OBJECT-SIZE %s13// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=pointer-overflow %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-POINTER-OVERFLOW %s14// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=return %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-RETURN %s15// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=returns-nonnull-attribute %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-RETURNS-NONNULL-ATTRIBUTE %s16// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=shift-base %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-SHIFT-BASE,CHECK-SHIFT %s17// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=shift-exponent %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-SHIFT-EXPONENT,CHECK-SHIFT %s18// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=shift %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-SHIFT %s19// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=signed-integer-overflow %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-SIGNED-INTEGER-OVERFLOW %s20// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=unreachable %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-UNREACHABLE %s21// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=vla-bound %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-VLA-BOUND %s22// RUN: %clang -E -target x86_64-unknown-linux-gnu -fsanitize=function %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-FUNCTION %s23 24// RUN: %clang -E  %s -o - | FileCheck --check-prefix=CHECK-NO-UBSAN %s25 26// REQUIRES: x86-registered-target27 28#if !__has_feature(undefined_behavior_sanitizer_finegrained_feature_checks)29#error "Missing undefined_behavior_sanitizer_finegrained_feature_checks"30#endif31 32#if __has_feature(undefined_behavior_sanitizer)33int UBSanEnabled();34#else35int UBSanDisabled();36#endif37 38#if __has_feature(alignment_sanitizer)39int AlignmentSanitizerEnabled();40#else41int AlignmentSanitizerDisabled();42#endif43 44#if __has_feature(bool_sanitizer)45int BoolSanitizerEnabled();46#else47int BoolSanitizerDisabled();48#endif49 50#if __has_feature(builtin_sanitizer)51int BuiltinSanitizerEnabled();52#else53int BuiltinSanitizerDisabled();54#endif55 56#if __has_feature(array_bounds_sanitizer)57int ArrayBoundsSanitizerEnabled();58#else59int ArrayBoundsSanitizerDisabled();60#endif61 62#if __has_feature(enum_sanitizer)63int EnumSanitizerEnabled();64#else65int EnumSanitizerDisabled();66#endif67 68#if __has_feature(float_cast_overflow_sanitizer)69int FloatCastOverflowSanitizerEnabled();70#else71int FloatCastOverflowSanitizerDisabled();72#endif73 74#if __has_feature(integer_divide_by_zero_sanitizer)75int IntegerDivideByZeroSanitizerEnabled();76#else77int IntegerDivideByZeroSanitizerDisabled();78#endif79 80#if __has_feature(nonnull_attribute_sanitizer)81int NonnullAttributeSanitizerEnabled();82#else83int NonnullAttributeSanitizerDisabled();84#endif85 86#if __has_feature(null_sanitizer)87int NullSanitizerEnabled();88#else89int NullSanitizerDisabled();90#endif91 92#if __has_feature(object_size_sanitizer)93int ObjectSizeSanitizerEnabled();94#else95int ObjectSizeSanitizerDisabled();96#endif97 98#if __has_feature(pointer_overflow_sanitizer)99int PointerOverflowSanitizerEnabled();100#else101int PointerOverflowSanitizerDisabled();102#endif103 104#if __has_feature(return_sanitizer)105int ReturnSanitizerEnabled();106#else107int ReturnSanitizerDisabled();108#endif109 110#if __has_feature(returns_nonnull_attribute_sanitizer)111int ReturnsNonnullAttributeSanitizerEnabled();112#else113int ReturnsNonnullAttributeSanitizerDisabled();114#endif115 116#if __has_feature(shift_base_sanitizer)117int ShiftBaseSanitizerEnabled();118#else119int ShiftBaseSanitizerDisabled();120#endif121 122#if __has_feature(shift_exponent_sanitizer)123int ShiftExponentSanitizerEnabled();124#else125int ShiftExponentSanitizerDisabled();126#endif127 128#if __has_feature(shift_sanitizer)129int ShiftSanitizerEnabled();130#else131int ShiftSanitizerDisabled();132#endif133 134#if __has_feature(signed_integer_overflow_sanitizer)135int SignedIntegerOverflowSanitizerEnabled();136#else137int SignedIntegerOverflowSanitizerDisabled();138#endif139 140#if __has_feature(unreachable_sanitizer)141int UnreachableSanitizerEnabled();142#else143int UnreachableSanitizerDisabled();144#endif145 146#if __has_feature(vla_bound_sanitizer)147int VLABoundSanitizerEnabled();148#else149int VLABoundSanitizerDisabled();150#endif151 152#if __has_feature(function_sanitizer)153int FunctionSanitizerEnabled();154#else155int FunctionSanitizerDisabled();156#endif157 158// CHECK-UBSAN: UBSanEnabled159// CHECK-ALIGNMENT: AlignmentSanitizerEnabled160// CHECK-BOOL: BoolSanitizerEnabled161// CHECK-BUILTIN: BuiltinSanitizerEnabled162// CHECK-ARRAY-BOUNDS: ArrayBoundsSanitizerEnabled163// CHECK-ENUM: EnumSanitizerEnabled164// CHECK-FLOAT-CAST-OVERFLOW: FloatCastOverflowSanitizerEnabled165// CHECK-INTEGER-DIVIDE-BY-ZERO: IntegerDivideByZeroSanitizerEnabled166// CHECK-NONNULL-ATTRIBUTE: NonnullAttributeSanitizerEnabled167// CHECK-NULL: NullSanitizerEnabled168// CHECK-OBJECT-SIZE: ObjectSizeSanitizerEnabled169// CHECK-POINTER-OVERFLOW: PointerOverflowSanitizerEnabled170// CHECK-RETURN: ReturnSanitizerEnabled171// CHECK-RETURNS-NONNULL-ATTRIBUTE: ReturnsNonnullAttributeSanitizerEnabled172// CHECK-SHIFT-BASE: ShiftBaseSanitizerEnabled173// CHECK-SHIFT-EXPONENT: ShiftExponentSanitizerEnabled174// CHECK-SHIFT: ShiftSanitizerEnabled175// CHECK-SIGNED-INTEGER-OVERFLOW: SignedIntegerOverflowSanitizerEnabled176// CHECK-UNREACHABLE: UnreachableSanitizerEnabled177// CHECK-VLA-BOUND: VLABoundSanitizerEnabled178// CHECK-FUNCTION: FunctionSanitizerEnabled179// CHECK-NO-UBSAN: UBSanDisabled180