DataFlowSanitizer; compiler-rt changes.
DataFlowSanitizer is a generalised dynamic data flow analysis.
Unlike other Sanitizer tools, this tool is not designed to detect a
specific class of bugs on its own. Instead, it provides a generic
dynamic data flow analysis framework to be used by clients to help
detect application-specific issues within their own code.
Differential Revision: http://llvm-reviews.chandlerc.com/D967
llvm-svn: 187924
diff --git a/compiler-rt/lib/dfsan/lit_tests/fncall.c b/compiler-rt/lib/dfsan/lit_tests/fncall.c
new file mode 100644
index 0000000..7d4706f
--- /dev/null
+++ b/compiler-rt/lib/dfsan/lit_tests/fncall.c
@@ -0,0 +1,25 @@
+// RUN: %clang_dfsan -m64 %s -o %t && %t
+
+// Tests that labels are propagated through function calls.
+
+#include <sanitizer/dfsan_interface.h>
+#include <assert.h>
+
+int f(int x) {
+ int j = 2;
+ dfsan_label j_label = dfsan_create_label("j", 0);
+ dfsan_set_label(j_label, &j, sizeof(j));
+ return x + j;
+}
+
+int main(void) {
+ int i = 1;
+ dfsan_label i_label = dfsan_create_label("i", 0);
+ dfsan_set_label(i_label, &i, sizeof(i));
+
+ dfsan_label ij_label = dfsan_get_label(f(i));
+ assert(dfsan_has_label(ij_label, i_label));
+ assert(dfsan_has_label_with_desc(ij_label, "j"));
+
+ return 0;
+}