1*f4a2713aSLionel Sambuc // Verify ubsan doesn't emit checks for blacklisted functions and files 2*f4a2713aSLionel Sambuc // RUN: echo "fun:hash" > %t-func.blacklist 3*f4a2713aSLionel Sambuc // RUN: echo "src:%s" > %t-file.blacklist 4*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT 5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-blacklist=%t-func.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC 6*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-blacklist=%t-file.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FILE 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc // FIXME: %t-file.blacklist contains DOSish paths. 9*f4a2713aSLionel Sambuc // REQUIRES: shell 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc unsigned i; 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambuc // DEFAULT: @hash 14*f4a2713aSLionel Sambuc // FUNC: @hash 15*f4a2713aSLionel Sambuc // FILE: @hash hash()16*f4a2713aSLionel Sambucunsigned hash() { 17*f4a2713aSLionel Sambuc // DEFAULT: call void @__ubsan 18*f4a2713aSLionel Sambuc // FUNC-NOT: call void @__ubsan 19*f4a2713aSLionel Sambuc // FILE-NOT: call void @__ubsan 20*f4a2713aSLionel Sambuc return i * 37; 21*f4a2713aSLionel Sambuc } 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc // DEFAULT: @add 24*f4a2713aSLionel Sambuc // FUNC: @add 25*f4a2713aSLionel Sambuc // FILE: @add add()26*f4a2713aSLionel Sambucunsigned add() { 27*f4a2713aSLionel Sambuc // DEFAULT: call void @__ubsan 28*f4a2713aSLionel Sambuc // FUNC: call void @__ubsan 29*f4a2713aSLionel Sambuc // FILE-NOT: call void @__ubsan 30*f4a2713aSLionel Sambuc return i + 1; 31*f4a2713aSLionel Sambuc } 32