]> granicus.if.org Git - clang/commitdiff
Correctly find overridden destructors.
authorAnders Carlsson <andersca@mac.com>
Thu, 26 Nov 2009 20:50:40 +0000 (20:50 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 26 Nov 2009 20:50:40 +0000 (20:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89966 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index 31c6ab543dd6f74efb1e447c728f0e94bf85c0e3..862fdfeabaf74f4f70ea9821e7d6bffa36a84ecb 100644 (file)
@@ -2587,10 +2587,23 @@ static bool FindOverriddenMethod(const CXXBaseSpecifier *Specifier,
                                  CXXBasePath &Path,
                                  void *UserData) {
   RecordDecl *BaseRecord = Specifier->getType()->getAs<RecordType>()->getDecl();
-  
+
   FindOverriddenMethodData *Data 
     = reinterpret_cast<FindOverriddenMethodData*>(UserData);
-  for (Path.Decls = BaseRecord->lookup(Data->Method->getDeclName());
+  
+  DeclarationName Name = Data->Method->getDeclName();
+  
+  // FIXME: Do we care about other names here too?
+  if (Name.getNameKind() == DeclarationName::CXXDestructorName) {
+    // We really want to find the base class constructor here.
+    QualType T = Data->S->Context.getTypeDeclType(BaseRecord);
+    CanQualType CT = Data->S->Context.getCanonicalType(T);
+    
+    DeclarationName Name = 
+      Data->S->Context.DeclarationNames.getCXXDestructorName(CT);
+  }    
+  
+  for (Path.Decls = BaseRecord->lookup(Name);
        Path.Decls.first != Path.Decls.second;
        ++Path.Decls.first) {
     if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(*Path.Decls.first)) {