[llvm-bugs] [Bug 35302] New: missing namespaces when underlying type is a template specialization

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 14 04:25:19 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35302

            Bug ID: 35302
           Summary: missing namespaces when underlying type is a template
                    specialization
           Product: clang
           Version: 5.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Istvan.SZOCS at nng.com
                CC: klimek at google.com, llvm-bugs at lists.llvm.org

I'm trying to analyze c++ header files using libclang python bindings.
The following example illustrates the inconsistent namespace handling in type
aliases.

Sample C++ code:

---------- BEGIN ----------
namespace n{
class MyClass{
};
template<typename T> class MyTemplateClass{
};
}
using namespace n;
using MyClassAlias = MyClass;
using MyTemplateClassAlias = MyTemplateClass<int>;
----------  END  ----------


Sample output generated by libclang python binding:

---------- BEGIN ----------
kind: 'TRANSLATION_UNIT' spelling: 'c:\namespace_bug.h'
  +--kind: 'NAMESPACE' spelling: 'n'
  |  +--kind: 'CLASS_DECL' spelling: 'MyClass'
  |  +--kind: 'CLASS_TEMPLATE' spelling: 'MyTemplateClass'
  |     +--kind: 'TEMPLATE_TYPE_PARAMETER' spelling: 'T'
  +--kind: 'USING_DIRECTIVE'
  |  +--kind: 'NAMESPACE_REF' spelling: 'n'
  +--kind: 'TYPE_ALIAS_DECL' spelling: 'MyClassAlias'
underlying_typedef_type.spelling: 'n::MyClass'
  |  +--kind: 'TYPE_REF' spelling: 'class n::MyClass'
  +--kind: 'TYPE_ALIAS_DECL' spelling: 'MyTemplateClassAlias'
underlying_typedef_type.spelling: 'MyTemplateClass<int>'
     +--kind: 'TEMPLATE_REF' spelling: 'MyTemplateClass'
----------  END  ----------

Namespace is missing from the spelling of underlying type in the second type
alias decl.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171114/bc6c196f/attachment.html>


More information about the llvm-bugs mailing list