[cfe-commits] r97621 - /cfe/trunk/lib/AST/CXXInheritance.cpp

Douglas Gregor dgregor at apple.com
Tue Mar 2 17:13:25 PST 2010


Author: dgregor
Date: Tue Mar  2 19:13:25 2010
New Revision: 97621

URL: http://llvm.org/viewvc/llvm-project?rev=97621&view=rev
Log:
Revert r97618. Access control sucks

Modified:
    cfe/trunk/lib/AST/CXXInheritance.cpp

Modified: cfe/trunk/lib/AST/CXXInheritance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CXXInheritance.cpp?rev=97621&r1=97620&r2=97621&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CXXInheritance.cpp (original)
+++ cfe/trunk/lib/AST/CXXInheritance.cpp Tue Mar  2 19:13:25 2010
@@ -140,20 +140,18 @@
   return AllMatches;
 }
 
-static bool lookupInBases(ASTContext &Context, const CXXRecordDecl *Record,
-                          CXXRecordDecl::BaseMatchesCallback *BaseMatches, 
-                          void *UserData,
-                          CXXBasePaths &Paths) {
+bool CXXRecordDecl::lookupInBases(BaseMatchesCallback *BaseMatches,
+                                  void *UserData,
+                                  CXXBasePaths &Paths) const {
   bool FoundPath = false;
 
   // The access of the path down to this record.
   AccessSpecifier AccessToHere = Paths.ScratchPath.Access;
   bool IsFirstStep = Paths.ScratchPath.empty();
 
-  for (CXXRecordDecl::base_class_const_iterator BaseSpec = Record->bases_begin(),
-         BaseSpecEnd = Record->bases_end(); 
-       BaseSpec != BaseSpecEnd; 
-       ++BaseSpec) {
+  ASTContext &Context = getASTContext();
+  for (base_class_const_iterator BaseSpec = bases_begin(),
+         BaseSpecEnd = bases_end(); BaseSpec != BaseSpecEnd; ++BaseSpec) {
     // Find the record of the base class subobjects for this type.
     QualType BaseType = Context.getCanonicalType(BaseSpec->getType())
                                                           .getUnqualifiedType();
@@ -188,7 +186,7 @@
       // Add this base specifier to the current path.
       CXXBasePathElement Element;
       Element.Base = &*BaseSpec;
-      Element.Class = Record;
+      Element.Class = this;
       if (BaseSpec->isVirtual())
         Element.SubobjectNumber = 0;
       else
@@ -214,8 +212,7 @@
         Paths.ScratchPath.Access = BaseSpec->getAccessSpecifier();
       else
         Paths.ScratchPath.Access
-          = CXXRecordDecl::MergeAccess(AccessToHere, 
-                                       BaseSpec->getAccessSpecifier());
+          = MergeAccess(AccessToHere, BaseSpec->getAccessSpecifier());
     }
     
     // Track whether there's a path involving this specific base.
@@ -236,7 +233,7 @@
       CXXRecordDecl *BaseRecord
         = cast<CXXRecordDecl>(BaseSpec->getType()->getAs<RecordType>()
                                 ->getDecl());
-      if (lookupInBases(Context, BaseRecord, BaseMatches, UserData, Paths)) {
+      if (BaseRecord->lookupInBases(BaseMatches, UserData, Paths)) {
         // C++ [class.member.lookup]p2:
         //   A member name f in one sub-object B hides a member name f in
         //   a sub-object A if A is a base class sub-object of B. Any
@@ -269,12 +266,6 @@
   return FoundPath;
 }
 
-bool CXXRecordDecl::lookupInBases(BaseMatchesCallback *BaseMatches,
-                                  void *UserData,
-                                  CXXBasePaths &Paths) const {
-  return ::lookupInBases(getASTContext(), this, BaseMatches, UserData, Paths);
-}
-
 bool CXXRecordDecl::FindBaseClass(const CXXBaseSpecifier *Specifier, 
                                   CXXBasePath &Path,
                                   void *BaseRecord) {





More information about the cfe-commits mailing list