[PATCH] Add DWARFFormValue::getAsSignedConstant().

Alexey Samsonov vonosmas at gmail.com
Tue Oct 7 18:23:46 PDT 2014


================
Comment at: unittests/DebugInfo/DWARFFormValueTest.cpp:10
@@ -9,2 +9,3 @@
 
+#include "../lib/DebugInfo/DWARFContext.h"
 #include "llvm/DebugInfo/DWARFFormValue.h"
----------------
friss wrote:
> samsonov wrote:
> > Unittests may only include headers from include/llvm (i.e., public headers). If we want to add unittests that instantiate DWARFContext, we should make corresponding header public.
> I was actually wondering about this, but I found one prior example of including ../lib/. I'm not sure what the best way forward is for this, if we make the Context public, then everything gets public. Not that I'm opposed to that, it would make some of my planned work easier, and I might propose that in the near future.
> 
> What would people think about making the whole DWARF stuff a pubilc interface to libDebugInfo ? (Note that right now this is just to get some testing for this very small feature  added just to be able to print AT_lower_bound as a signed decimal... I was already embarrassed by the amount of Dummy* instantiations to get my small test running, but getting the whole interface made public just for that seems a bit too much, doesn't it?)
I don't really know. Certainly, this set up is an overkill for a small unit test you have. Testing isolated components of DWARF parser are hard because of all the relationship between various sections. However, we can expose DWARFContext.h in public headers somewhere under include/llvm/DebugInfo/DWARF, then create a DWARFTestContext in unittests/, and reuse it in various unit tests. I'm not sure if it would be convenient, or we'd actually need that many unit tests.

http://reviews.llvm.org/D5630






More information about the llvm-commits mailing list