johanengelen added a comment.

In, @timotheecour wrote:

> > It's a little more complicated for D because it's an out-of-tree compiler 
> > so it poses interesting challenges.
> the demangling itself is thoroughly tested in 

It's not the correct demangling of strings that needs to be tested. What needs 

- recognising D language and D mangled name
- loading of dynamic lib (plus testing that when loading fails lldb doesn't 
crash/exit; note: errmsg can be improved to e.g. "Failed to load D language 
- test that indeed the demangling function of the dyn lib is called

To test this, I think you can make a mock dynamic lib that implements the 
required interface, but in C++. The mock demangler could be something like this 
or even simpler:

  extern "C" char* lldbd_demangle(size_t length, const char* mangled) {
     if (mangled == "_D3fooFZv") // pseudo code
         return "void foo()";
         return mangled;

Then build that library in the test, and test loading and use on a fabricated 
piece of code (probably easiest to use C code with this in it: `extern "C" 
_D3fooFZv() { trap(); }`.

lldb-commits mailing list

Reply via email to