[llvm-bugs] [Bug 27532] New: injected-class-name should not be modelled as a CXXRecordDecl

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 26 16:40:23 PDT 2016


            Bug ID: 27532
           Summary: injected-class-name should not be modelled as a
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

We currently model an injected-class-name declaration as a CXXRecordDecl. This
leads to a number of problems and violations of our usual AST invariants. For

 * the redecl chain of a ClassTemplateSpecializationDecl contains declarations
that are not ClassTemplateSpecializationDecls, and getPreviousDecl sometimes
(!!!) skips over them (depending on the static type of the object expression)

 * not all declarations of the same entity are guaranteed to have the same
semantic DeclContext

 * we waste memory on a DeclContext that can never have any children or lookups

... and so on.

Given that most lookups that find the injected-class-name are actually required
to find the constructors rather than the type, this is an especially poor

We should use a different kind of Decl here (InjectedClassNameDecl?) and update
the (relatively small) number of places that really want to map from the
injected-class-name to the class type to do so manually.

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/20160426/9de4f716/attachment.html>

More information about the llvm-bugs mailing list