[cfe-dev] Incorrect output from typePrinter

Dan Jump Dan.Jump at microsoft.com
Wed Aug 27 09:40:07 PDT 2014


I'm using clang libraries to parse the input code below.

I call getAsString on the QualType for the return value of Real::Get() and get:


This is wrong, it should return:


I've stepped through the typePrinter code. Test2::Thing is an elaborated type, and TypePrinter::printElaboratedBefore turns off the scope printing when it prints the template arguments. This results in Test1::Zoo being printed without any scope, hence the bug.

Is this a known issue and any thoughts on a workaround?

Sample code:

namespace Test1 { struct Zoo; }

namespace Test2 {

  template<typename T>
  struct Thing {};

  template<typename T>
  struct Base
     virtual Test2::Thing<T>* Get() = 0;

  struct Real : public Base < Test1::Zoo >


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140827/690781fc/attachment.html>

More information about the cfe-dev mailing list