[cfe-commits] r60947 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp test/SemaCXX/constructor.cpp test/SemaCXX/destructor.cpp

Douglas Gregor dgregor at apple.com
Fri Dec 12 07:20:15 PST 2008


On Dec 12, 2008, at 12:25 AM, Douglas Gregor wrote:

> Author: dgregor
> Date: Fri Dec 12 02:25:50 2008
> New Revision: 60947
>
> URL: http://llvm.org/viewvc/llvm-project?rev=60947&view=rev
> Log:
> Enable out-of-line definitions of C++ constructors and destructors
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Dec 12 02:25:50 2008
> @@ -246,6 +246,24 @@
>   } else if (LookupCtx) {
>     assert(getLangOptions().CPlusPlus && "No qualified name lookup  
> in C");
>
> +    switch (Name.getNameKind()) {
> +    case DeclarationName::CXXConstructorName:
> +      if (const CXXRecordDecl *Record =  
> dyn_cast<CXXRecordDecl>(LookupCtx))
> +        return const_cast<CXXRecordDecl *>(Record)- 
> >getConstructors();
> +      else
> +        return 0;
> +
> +    case DeclarationName::CXXDestructorName:
> +      if (const CXXRecordDecl *Record =  
> dyn_cast<CXXRecordDecl>(LookupCtx))
> +        return Record->getDestructor();
> +      else
> +        return 0;
> +
> +    default:
> +      // Normal name lookup.
> +      break;
> +    }
> +

On further reflection, this is an ugly hack. We should be putting  
constructors and destructors directly into the DeclContext, so this  
new code can just go away.

   - Doug



More information about the cfe-commits mailing list