[compiler-rt] r188231 - [dfsan] Begin a private header and move shadow_for there.
Peter Collingbourne
peter at pcc.me.uk
Mon Aug 12 16:51:34 PDT 2013
Author: pcc
Date: Mon Aug 12 18:51:33 2013
New Revision: 188231
URL: http://llvm.org/viewvc/llvm-project?rev=188231&view=rev
Log:
[dfsan] Begin a private header and move shadow_for there.
Differential Revision: http://llvm-reviews.chandlerc.com/D1348
Added:
compiler-rt/trunk/lib/dfsan/dfsan.h
Modified:
compiler-rt/trunk/lib/dfsan/dfsan.cc
Modified: compiler-rt/trunk/lib/dfsan/dfsan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/dfsan.cc?rev=188231&r1=188230&r2=188231&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/dfsan.cc (original)
+++ compiler-rt/trunk/lib/dfsan/dfsan.cc Mon Aug 12 18:51:33 2013
@@ -24,6 +24,10 @@
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_libc.h"
+#include "dfsan/dfsan.h"
+
+using namespace __dfsan;
+
typedef atomic_uint16_t atomic_dfsan_label;
static const dfsan_label kInitializingLabel = -1;
@@ -68,10 +72,6 @@ static atomic_dfsan_label *union_table(d
return &(*(dfsan_union_table_t *) kUnionTableAddr)[l1][l2];
}
-static dfsan_label *shadow_for(void *ptr) {
- return (dfsan_label *) ((((uintptr_t) ptr) & ~0x700000000000) << 1);
-}
-
// Resolves the union of two unequal labels. Nonequality is a precondition for
// this function (the instrumentation pass inlines the equality test).
extern "C" SANITIZER_INTERFACE_ATTRIBUTE
Added: compiler-rt/trunk/lib/dfsan/dfsan.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/dfsan.h?rev=188231&view=auto
==============================================================================
--- compiler-rt/trunk/lib/dfsan/dfsan.h (added)
+++ compiler-rt/trunk/lib/dfsan/dfsan.h Mon Aug 12 18:51:33 2013
@@ -0,0 +1,32 @@
+//===-- dfsan.h -------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of DataFlowSanitizer.
+//
+// Private DFSan header.
+//===----------------------------------------------------------------------===//
+
+#ifndef DFSAN_H
+#define DFSAN_H
+
+#include "sanitizer/dfsan_interface.h"
+
+namespace __dfsan {
+
+inline dfsan_label *shadow_for(void *ptr) {
+ return (dfsan_label *) ((((uintptr_t) ptr) & ~0x700000000000) << 1);
+}
+
+inline const dfsan_label *shadow_for(const void *ptr) {
+ return shadow_for(const_cast<void *>(ptr));
+}
+
+} // namespace __dfsan
+
+#endif // DFSAN_H
More information about the llvm-commits
mailing list