[cfe-dev] PATCH: Semantic analysis and representation of C++ base classes

Doug Gregor doug.gregor at gmail.com
Fri May 2 18:08:55 PDT 2008

This patch adds the missing semantic analysis and representation for
C++ base classes. This does a couple of related things:

  - BaseClassDecl represents a base class of a RecordDecl

  - Sema::ActOnBaseSpecifiers attaches the base specifiers to a
RecordDecl and checks that there are no redundant direct base classes.

  - Action::isTypeName now has a new argument, IgnoreNonTypes, which
instructs name lookup to do exactly that. It's needed when looking up
base class names (see C++ [class.derived]p2), e.g.,

    class A { };

    void foo(int A) {
      class B : A { }; // okay: we find class A, not the parameter A.

    As part of this, there's a new IdentifierNamespace enumerator
called IDNS_Ignore_nontypes, which tells the IdentifierResolver to
ignore non-type names. This means that IdentifierNamespace is becoming
much more like a set of flags dictating name lookup rules rather than
the 4 C namespaces it started at. Expect more movement in this
direction as Clang gets more C++-specific name lookup behavior.

  - Doug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-inherit.patch
Type: application/octet-stream
Size: 27374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080502/dde7c7ba/attachment.obj>

More information about the cfe-dev mailing list