diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-12-12 08:25:50 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-12-12 08:25:50 +0000 |
commit | 4287b3738923ee6c833c42937aed8735ee9c45e0 (patch) | |
tree | b1b4236e63bf4d802e587738c65e9720f7eae1b7 /clang/lib/Sema/SemaDecl.cpp | |
parent | e4bcb8e2dd976268eed4db589ddc94edd6408d40 (diff) | |
download | bcm5719-llvm-4287b3738923ee6c833c42937aed8735ee9c45e0.tar.gz bcm5719-llvm-4287b3738923ee6c833c42937aed8735ee9c45e0.zip |
Enable out-of-line definitions of C++ constructors and destructors
llvm-svn: 60947
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 29d636fabdc..2c5e46afa0e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -246,6 +246,24 @@ Decl *Sema::LookupDecl(DeclarationName Name, unsigned NSI, Scope *S, } 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; + } + // Perform qualified name lookup into the LookupCtx. // FIXME: Will need to look into base classes and such. DeclContext::lookup_const_iterator I, E; @@ -932,6 +950,15 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { // after the point of declaration in a namespace that encloses the // declarations namespace. // + // FIXME: We need to perform this check later, once we know that + // we've actually found a redeclaration. Otherwise, just the fact + // that there is some entity with the same name will suppress this + // diagnostic, e.g., we fail to diagnose: + // class X { + // void f(); + // }; + // + // void X::f(int) { } // ill-formed, but we don't complain. if (PrevDecl == 0) { // No previous declaration in the qualifying scope. Diag(D.getIdentifierLoc(), diag::err_typecheck_no_member) |