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

            Bug ID: 27532
           Summary: injected-class-name should not be modelled as a
                    CXXRecordDecl
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: richard-l...@metafoo.co.uk
                CC: dgre...@apple.com, llvm-bugs@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
instance:

 * 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
representation.

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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to