[PATCH] Add function to get the number of DFSan labels allocated.

Sam Kerner skerner at chromium.org
Tue Mar 25 10:03:50 PDT 2014


  > One approach that I've seen for maintaining multiple translation units in a single file is to control which translation unit is output using preprocessor macros.

  Good idea.  Done.


================
Comment at: lib/dfsan/dfsan.cc:233
@@ -232,1 +232,3 @@
 
+extern "C" SANITIZER_INTERFACE_ATTRIBUTE int
+dfsan_get_label_count(void) {
----------------
Peter Collingbourne wrote:
> Sam Kerner wrote:
> > Peter Collingbourne wrote:
> > > Is "int" the right return type for this function? I'd imagine it should be "dfsan_label", especially if we ever extend dfsan_label to 32 bits in the future.
> > I initially avoided using dfsan_label as the return type because the fact that the label is an integer (of any specific size) is an implementation detail.  On the other hand, it is a detail that seems unlikely to change.
> > 
> > I created a new type dfsan_label_count_t .  I can't decide if it is a better choice than returning dfsan_label, so I will leave the choice to you.
> > 
> Yes, that is a good point. Can you make this function return a value of type size_t (external) / uptr (internal)?
Done.

================
Comment at: test/dfsan/lib/other_transactional_unit.h:1
@@ +1,2 @@
+// Functions used in tests which must be in a separate transactional unit.
+// This prevents the compiler from optimizing code in a way that removes
----------------
Peter Collingbourne wrote:
> Nit: "translation unit" (here and elsewhere).
Done.


http://llvm-reviews.chandlerc.com/D3109



More information about the llvm-commits mailing list