[PATCH] D116064: [WIP] Test for noundef ignore list

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 20 17:16:03 PST 2021


vitalybuka created this revision.
vitalybuka added a reviewer: kda.
vitalybuka requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116064

Files:
  clang/test/CodeGen/attr-noundef-no-sanitize.cpp


Index: clang/test/CodeGen/attr-noundef-no-sanitize.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGen/attr-noundef-no-sanitize.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -enable-noundef-analysis -fsanitize=memory %s -o - | FileCheck %s --check-prefixes=CHECK,NOUNDEF
+// RUN: %clang -cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm -enable-noundef-analysis -fsanitize=memory %s -o - | FileCheck %s --check-prefixes=CHECK,NOUNDEF
+// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -enable-noundef-analysis -fsanitize=memory -fsanitize-ignorelist=%S/Inputs/sanitizer-special-case-list.sanitized.txt %s -o - | FileCheck %s --check-prefixes=CHECK,IGNORE
+// RUN: %clang -cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm -enable-noundef-analysis -fsanitize=memory -fsanitize-ignorelist=%S/Inputs/sanitizer-special-case-list.sanitized.txt %s -o - | FileCheck %s --check-prefixes=CHECK,IGNORE
+
+int ret_trivial() { return {}; }
+// CHECK: define dso_local noundef i32 @{{.*}}ret_trivial{{.*}}(
+
+void pass_trivial(int e) {}
+// CHECK: define dso_local void @{{.*}}pass_trivial{{.*}}(i32 noundef %
+
+void call_trivial() {
+  pass_trivial(ret_trivial());
+  // CHECK: call noundef i32 @{{.*}}ret_trivial{{.*}}(
+  // CHECK: call void @{{.*}}pass_trivial{{.*}}(i32 noundef %
+}
+
+int ret_ignored() { return {}; }
+// NOUNDEF: define dso_local noundef i32 @{{.*}}ret_ignored{{.*}}(
+// IGNORE: define dso_local i32 @{{.*}}ret_ignored{{.*}}(
+
+void pass_ignored(int e) {}
+// NOUNDEF: define dso_local void @{{.*}}pass_ignored{{.*}}(i32 noundef %
+// IGNORE: define dso_local void @{{.*}}pass_ignored{{.*}}(i32 %
+
+void call_ignored() {
+  pass_ignored(ret_ignored());
+  // NOUNDEF: call noundef i32 @{{.*}}ret_ignored{{.*}}(
+  // IGNORE: call i32 @{{.*}}ret_ignored{{.*}}(
+  // NOUNDEF: call void @{{.*}}pass_ignored{{.*}}(i32 noundef %
+  // IGNORE: call void @{{.*}}pass_ignored{{.*}}(i32 %
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116064.395555.patch
Type: text/x-patch
Size: 2018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211221/c1ba8dad/attachment.bin>


More information about the cfe-commits mailing list