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