[cfe-commits] r89966 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Anders Carlsson andersca at mac.com
Thu Nov 26 12:50:41 PST 2009


Author: andersca
Date: Thu Nov 26 14:50:40 2009
New Revision: 89966

URL: http://llvm.org/viewvc/llvm-project?rev=89966&view=rev
Log:
Correctly find overridden destructors.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=89966&r1=89965&r2=89966&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Nov 26 14:50:40 2009
@@ -2587,10 +2587,23 @@
                                  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)) {





More information about the cfe-commits mailing list